我有<span>
元素的页脚。在移动屏幕(我预期):
桌面显示(不应该分成新行):
我的HTML和CSS:
@media screen and (min-width: 768px) {
.rwd-line {
display: inline;
white-space: nowrap;
}
}
.rwd-line {
display: block;
}
<h4 class="text-center">
<span class="rwd-line">©<?php echo date('Y') ?> PT Paket Informasi Digital<span class="visible-lg">•</span></span>
<span class="rwd-line"><a href="https://blog.paket.id" target="_blank">Blog</a><span class="visible-lg">•</span></span>
<span class="rwd-line"><a href="https://docs.paket.id" target="_blank">Documentation</a><span class="visible-lg">•</span></span>
<span class="rwd-line"><i class="fi flaticon-phone"></i>+62 878 0878 3630</span>
</h4>
我试过了:
答案 0 :(得分:0)
you need to declare the media query last, like this:
.rwd-line {
display: block;
}
@media screen and (min-width: 768px) {
.rwd-line {
display: inline;
white-space: nowrap;
}
}
答案 1 :(得分:0)
更改显示:阻止;显示:内联块;或尝试一次。
.rwd-line {
display: inline-block;
white-space: nowrap;
}
答案 2 :(得分:0)
答案可能在于你的可见lg类,这是你想要发生的吗?
(查看全屏并调整窗口宽度)
.text-center {
text-align: center;
}
.rwd-line {
display: block;
}
.visible-lg {
display: none;
}
@media (min-width: 768px) {
.rwd-line {
display: inline-block;
white-space: nowrap;
}
.visible-lg {
display: inline-block;
padding-left: 5px;
}
}
&#13;
<div class="text-center">
<span class="rwd-line">©<?php echo date('Y') ?> PT Paket Informasi Digital<span class="visible-lg">•</span></span>
<span class="rwd-line"><a href="https://blog.paket.id" target="_blank">Blog</a><span class="visible-lg">•</span></span>
<span class="rwd-line"><a href="https://docs.paket.id" target="_blank">Documentation</a><span class="visible-lg">•</span></span>
<span class="rwd-line"><i class="fi flaticon-phone"></i>+62 878 0878 3630</span>
</div>
&#13;
<强>拨弄强>