gpt4 book ai didi

javascript - 设置div高度;内部跨度文本居中

转载 作者:太空宇宙 更新时间:2023-11-03 23:23:53 24 4
gpt4 key购买 nike

因此,当我为 grid-cart-message 或 messages-cart-view 部分分配高度时,内部跨度文本不会相应地居中。它在 div 中被切断。任何可能的方法来克服这个?谢谢。

    .grid-cart-message {
background: none repeat scroll 0 0 #05b1eb;
overflow: hidden;
}

.grid-cart-message #messages-cart-view .error-msg span, .grid-cart-message #messages-cart-view .success-msg span {
color: #fff;
display: block;
float: left;
font-weight: bold;
margin: 1em 0 1em 1em;
text-shadow: 0 -0.1em #666;
}
.grid-cart-message #messages-cart-view {
float: left;
margin: 0 1%;
width: 98%;
}
    <div class = "grid-cart-message">
<div class="grid-max">
<div id="messages-cart-view">
<ul class="messages">
<li class="success-msg">
<ul>
<li>
<span>Here is some text that is dynamically assigned.</span>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>

最佳答案

试试这个

自从您添加了 margin 之后,您就遇到了这个问题

.grid-cart-message {
background: none repeat scroll 0 0 #05b1eb;
overflow: hidden;
}

.grid-cart-message #messages-cart-view .error-msg span, .grid-cart-message #messages-cart-view .success-msg span {
color: #fff;
display: block;
float: left;
font-weight: bold;

text-shadow: 0 -0.1em #666;
}
.grid-cart-message #messages-cart-view {
float: left;
margin: 0 1%;
width: 98%;
}
    <div class = "grid-cart-message">
<div class="grid-max">
<div id="messages-cart-view">
<ul class="messages">
<li class="success-msg">
<ul>
<li>
<span>Here is some text that is dynamically assigned.</span>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>

关于javascript - 设置div高度;内部跨度文本居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27781195/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com