如何设置这些div的样式,使它们在没有项目符号的情况下显示在一行上?
<div>
Copyright (c) 2013 Acme Inc. All rights reserved.
</div>
<div>
<ul>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Terms & Conditions</a></li>
</ul>
</div>
示例:版权所有(c)2013 Acme Inc.保留所有权利。隐私政策条款和条款条件
答案 0 :(得分:1)
您应该向<ul>
或父<div>
添加课程。
<div class='copyright'>
Copyright (c) 2013 Acme Inc. All rights reserved.
</div>
<ul class='footer'>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Terms & Conditions</a></li>
</ul>
然后调整CSS:
.footer {
list-style-type: none;
display: inline;
}
.footer li, .copyright {
display: inline;
}
或
.footer li, .copyright {
display: inline-block;
}
或
.footer li, .copyright {
display: block;
float: left;
}
添加课程.footer
是非常可选的,但在我看来非常推荐。您只需将css选择器调整为ul { list-style-type: none; }
或ul li { ... }
但说实话,为什么你不单纯使用它?
<div>
Copyright (c) 2013 Acme Inc. All rights reserved.
<a href='#'>Privacy Policy</a>
<a href='#'>Terms & Conditions</a>
</div>
答案 1 :(得分:1)
<html>
<body>
<div style="display:inline">
Copyright (c) 2013 Acme Inc. All rights reserved.
</div>
<div style="display:inline">
<ul style="display:inline">
<li style="display:inline"><a href="#">Privacy Policy</a></li>
<li style="display:inline"><a href="#">Terms & Conditions</a></li>
</ul>
</div>
</body>
</html>