HTML – 如何制作一个CSS’蜗牛’?
发布时间:2020-12-31 00:57:49 所属栏目:资源 来源:网络整理
导读:我有一个想要显示为圆形的图像(边界半径:50%),并且在同一行上我想要一些具有设置宽度和背景的文本.我不想硬编码任何值.实现这个目标的最佳方法是什么? 这是picture fiddle div class="header" img class="i" src="http://www.planwallpaper.com/static/im
|
我有一个想要显示为圆形的图像(边界半径:50%),并且在同一行上我想要一些具有设置宽度和背景的文本.我不想硬编码任何值.实现这个目标的最佳方法是什么? 这是picture fiddle <div class="header">
<img class="i" src="http://www.planwallpaper.com/static/images/colorful-triangles-background_yB0qTG6.jpg"/>
<p class="headingText">Hello</p>
</div>
.i {
width: 80px;
height: 80px;
border-radius: 50%;
}
.headingText {
color: white;
background: black;
display: inline-block;
width: 350px;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
}
解决方法你可以尝试这样的事情:.header
{
padding-top:26px;
padding-left:40px;
position:relative;
}
.i
{
position:absolute;
width:80px;
height:80px;
border-radius:50%;
top:0;
left:0;
}
.headingText
{
color:white;
background:black;
display:inline-block;
width:350px;
padding-top:10px;
padding-bottom:10px;
text-align:center;
}
(编辑:威海站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
