你如何强制文本换行并保持居中定位?

时间:2012-11-26 00:13:33

标签: html css

如何让“立即购买”成为两条不同的线并居中?

以下是我的相关代码:

.popover{
    position: absolute;
    display: none;
    color: white;
    z-index: 1500;
    text-align: center;
    background-color: black;
    font-family: impact;
    text-decoration: none;
    font-size: 50px;
    opacity: .8;
}
.pb1{
    bottom: 10px;
    width: 260px;
    height: 238px;
}

<div class="popover pb1" ><br/>SHOP NOW</div>

2 个答案:

答案 0 :(得分:1)

我会添加span标记。检查解决方案here

答案 1 :(得分:1)

添加以下样式

.pb2{
    margin-top: 50px;
}

将内容更改为此

<div class="popover pb1" >
    <div class="pb2">SHOP<br /> NOW</div>
</div>​