我必须创建一个聊天应用程序文本框作为下面附加的图像,我已经尝试但我无法创建文本框,因为它在那里呈现。
.leftpanel-messages {
background-color: #FFFFFF;
padding: 5px 5px 0px 5px;
float: left;
}
.leftpanel-messages ul {
list-style: none;
margin: 0;
padding: 0;
}
.leftpanel-messages ul li {
display:inline-block;
clear: both;
padding: 5px 15px 5px 10px;
border-radius: 10px;
border-bottom-right-radius: 0;
margin-bottom: 2px;
font-family: Helvetica, Arial, sans-serif;
position: relative;
}
.him {
background: transparent;
border:1px solid #eee;
float: left;
}
.him > p {
font-size: 13px;
margin: 0 0 0.2rem 0;
}
.me {
float: right;
background: #0084ff;
color: #fff;
}
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 leftpanel-messages">
<div class="" style="padding:15px 10px 0 10px;">
<ul>
<li class="him">
<p>Text message send by him</p>
<div></div>
</li>
</ul>
</div>
</div>
任何人都可以帮我在文本框的末尾添加右上角吗?
答案 0 :(得分:3)
使用:before
和:after
.leftpanel-messages {
background-color: #FFFFFF;
padding: 5px 5px 0px 5px;
float: left;
}
.leftpanel-messages ul {
list-style: none;
margin: 0;
padding: 0;
}
.leftpanel-messages ul li {
display:inline-block;
clear: both;
padding: 5px 15px 5px 10px;
border-radius: 10px;
border-bottom-right-radius: 0;
margin-bottom: 2px;
font-family: Helvetica, Arial, sans-serif;
position: relative;
}
.him {
background: transparent;
border:1px solid #eee;
float: left;
position: relative;
}
.him > p {
font-size: 13px;
margin: 0 0 0.2rem 0;
}
.me {
float: right;
background: #0084ff;
color: #fff;
}
.him:before {
width: 0;
height: 0;
border-style: solid;
border-width: 13px 0 0 13px;
border-color: transparent transparent transparent #eee;
position: absolute;
content: '';
bottom: -1px;
right: -12px;
transform: scale(0.7, 1);
}
.him:after {
width: 0;
height: 0;
border-style: solid;
border-width: 12px 0 0 12px;
border-color: transparent transparent transparent #ffffff;
position: absolute;
content: '';
bottom: 0;
right: -10px;
transform: scale(0.7, 1);
}
&#13;
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 leftpanel-messages">
<div class="" style="padding:15px 10px 0 10px;">
<ul>
<li class="him">
<p>Text message send by him</p>
<div></div>
</li>
</ul>
</div>
</div>
&#13;
或者你可以只使用一个伪元素:before
,背景图像带有一个小三角形。