我有一个带实线边框的div,想要在其上方叠加一个居中的Logo。
目前我有一个解决方案,只需将图像嵌入页面,然后使用'margin-top:-13px;text-align:center;'将其移动到位置。
我已经在Chrome和Edge桌面版本上进行了测试,它可以正常工作... 我需要使用@media来调整margin-top以使其在我的手机上正常工作... 但是...这是一个好的方法吗?还是你有更好的方法?
谢谢,
Chris
目前我有一个解决方案,只需将图像嵌入页面,然后使用'margin-top:-13px;text-align:center;'将其移动到位置。
https://jsfiddle.net/christophera/43Ljmoh9/
.inside-article {
margin-top:20px;
border-top-style: solid;
border-top-width: 5px;
border-top-color: red;
}
.pos-logo {
margin-top:-13px;
text-align:center;
}
<div class="inside-article">
<div class="pos-logo">
<img style="width:120px;" src="https://test.consumer.press/img/consumer-press.svg" />
</div>
</div>
我已经在Chrome和Edge桌面版本上进行了测试,它可以正常工作... 我需要使用@media来调整margin-top以使其在我的手机上正常工作... 但是...这是一个好的方法吗?还是你有更好的方法?
谢谢,
Chris