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

76 lines
1.8 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 1
title: 位置
---
2015-06-03 17:08:43 +08:00
2015-11-03 13:50:36 +08:00
位置有 12 个方向。
2015-06-03 17:08:43 +08:00
````jsx
import { Tooltip } from 'antd';
const text = <span>提示文字</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}>
2015-11-04 20:48:51 +08:00
<a href="#">上左</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="top" title={text}>
2015-11-04 20:48:51 +08:00
<a href="#">上边</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="topRight" title={text}>
2015-11-04 20:48:51 +08:00
<a href="#">上右</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}>
<a href="#">左上</a>
</Tooltip>
<Tooltip placement="left" title={text}>
2015-12-23 18:07:31 +08:00
<a href="#">左边</a>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="leftBottom" title={text}>
<a href="#">左下</a>
</Tooltip>
</div>
<div style={{ width: 60, marginLeft: 270 }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="rightTop" title={text}>
<a href="#">右上</a>
</Tooltip>
<Tooltip placement="right" title={text}>
<a href="#">右边</a>
</Tooltip>
<Tooltip placement="rightBottom" title={text}>
<a href="#">右下</a>
</Tooltip>
</div>
<div style={{ marginLeft: 60, clear: 'both' }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="bottomLeft" title={text}>
<a href="#">上右</a>
</Tooltip>
<Tooltip placement="bottom" title={text}>
<a href="#">下边</a>
</Tooltip>
<Tooltip placement="bottomRight" title={text}>
<a href="#">下右</a>
</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>