我的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;
}
重新排列如下图像
答案 0 :(得分:3)
这样就可以了解http://jsfiddle.net/elclanrs/hu38A/1
.bubble:after {
content: "";
position: absolute;
border-color: transparent transparent transparent red;
border-style: solid;
border-width: 10px;
height: 0;
width: 0;
top: 50%;
margin-top: -10px; /* border-width */
right: -20px; /* border-width*2; */
}
答案 1 :(得分:3)
结帐this jsFiddle。您需要做的就是更改::after
元素的绝对定位,并从中切换哪个边框有颜色:
border-color: blue transparent transparent transparent;
bottom:-19px;
left:1em;
对此:
border-color: transparent transparent transparent blue;
bottom:25%;
right:-19px;