ant-design/components/tooltip/demo/placement.md

84 lines
1.9 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 1
2016-08-02 16:06:46 +08:00
title:
zh-CN: 位置
en-US: Placement
2016-03-31 09:40:55 +08:00
---
2015-06-03 17:08:43 +08:00
2016-08-02 16:06:46 +08:00
## zh-CN
2015-11-03 13:50:36 +08:00
位置有 12 个方向。
2015-06-03 17:08:43 +08:00
2016-08-02 16:06:46 +08:00
## en-US
The ToolTip has 12 placements choice.
2015-06-03 17:08:43 +08:00
````jsx
import { Tooltip } from 'antd';
2016-08-02 16:06:46 +08:00
const text = <span>prompt text</span>;
2015-06-03 17:08:43 +08:00
2015-10-20 16:47:55 +08:00
ReactDOM.render(
2015-06-03 20:43:03 +08:00
<div>
<div style={{ marginLeft: 60 }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="topLeft" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">topLeft</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="top" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">top</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="topRight" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">topRight</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
<div style={{ width: 60, float: 'left' }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="leftTop" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">leftTop</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="left" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">left</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="leftBottom" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">leftBottom</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
<div style={{ width: 60, marginLeft: 270 }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="rightTop" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">rightTop</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="right" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">right</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="rightBottom" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">rightBottom</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
<div style={{ marginLeft: 60, clear: 'both' }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="bottomLeft" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">bottomLeft</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="bottom" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">bottom</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="bottomRight" title={text}>
2016-08-02 16:06:46 +08:00
<a href="#">bottomRight</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
2015-06-03 20:43:03 +08:00
</div>
, mountNode);
2015-06-03 17:08:43 +08:00
````
2015-06-03 20:43:03 +08:00
<style>
#components-tooltip-demo-placement a {
2015-11-03 14:25:34 +08:00
display: inline-block;
2015-11-04 19:32:54 +08:00
line-height: 32px;
height: 32px;
2015-11-04 20:48:51 +08:00
width: 60px;
font-size: 14px;
2015-11-03 14:25:34 +08:00
text-align: center;
2015-11-04 19:32:54 +08:00
background: #f5f5f5;
2015-06-03 20:43:03 +08:00
margin-right: 1em;
2015-11-03 14:25:34 +08:00
margin-bottom: 1em;
border-radius: 6px;
2015-06-03 20:43:03 +08:00
}
</style>