【发布时间】:2019-03-02 11:47:25
【问题描述】:
在下面的程序中,为什么margin-right 值(+ve/-ve)对工具提示文本没有影响? margin-left 工作正常,但 margin-right 没有影响?谢谢
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
top: 100%;
margin-right: 100px;
}
<h2>Bottom Tooltip</h2>
<p>Move the mouse over the text below:</p>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>
【问题讨论】:
-
我记得你需要添加左或右位置值才能工作。
-
@Paulie_D 抱歉没有找到你