CSS 修改以排列指针
我的 html 上有一个 css 工具提示。我在气泡底部看到箭头标记(bubble:after)
。如何重新排列到气泡的右中心?
这是我的 div
<div class="bubble">Hi there. I like turtles.</div>
<p style="margin-left: 1em;">Mikey sez</p>
我的 div 上显示的气泡来自下面的 css
<style type="text/css">
.bubble {
position: relative;
background-color:#eee;
margin: 0;
padding:10px;
text-align:center;
width:180px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
-webkit-box-shadow: 0px 0 3px rgba(0,0,0,0.25);
-moz-box-shadow: 0px 0 3px rgba(0,0,0,0.25);
box-shadow: 0px 0 3px rgba(0,0,0,0.25);
}
.bubble:after { //This after mark has to be arranged so to point to the right of bubble
position: absolute; //The position should be at the center
display: block;
content: "";
border-color: #eee transparent transparent transparent;
border-style: solid;
border-width: 10px;
height:0;
width:0;
position:absolute;
bottom:-19px;
left:1em;
}
如下图所示重新排列
I have a css tooltip on my html. I get the arrow mark(bubble:after)
at the bottom of my bubble. How can I re-arrange to right center of my bubble?
Here is my div
<div class="bubble">Hi there. I like turtles.</div>
<p style="margin-left: 1em;">Mikey sez</p>
The bubble which is displayed on my div is from the css below
<style type="text/css">
.bubble {
position: relative;
background-color:#eee;
margin: 0;
padding:10px;
text-align:center;
width:180px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
-webkit-box-shadow: 0px 0 3px rgba(0,0,0,0.25);
-moz-box-shadow: 0px 0 3px rgba(0,0,0,0.25);
box-shadow: 0px 0 3px rgba(0,0,0,0.25);
}
.bubble:after { //This after mark has to be arranged so to point to the right of bubble
position: absolute; //The position should be at the center
display: block;
content: "";
border-color: #eee transparent transparent transparent;
border-style: solid;
border-width: 10px;
height:0;
width:0;
position:absolute;
bottom:-19px;
left:1em;
}
Rearrange like below image
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看这个jsFiddle。您需要做的就是更改
::after
元素的绝对定位,并切换边框的颜色,从:到:
Check out this jsFiddle. All you need to do is change the absolute positioning of the
::after
element, and switch which border has a colour, from this:To this:
这样就可以了,http://jsfiddle.net/elclanrs/hu38A/1
This will do the trick, http://jsfiddle.net/elclanrs/hu38A/1