我是网络编程的新手,我无法弄清楚,如何不仅放置文本,还放置中心的无序列表项目符号?这是代码:
<div style="text-align:center;">
<h2 style="margin-top:43px;" class="text-center">Important years of life and work:</h2>
<ul >
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
</div>
答案 0 :(得分:2)
试试这个
div{
text-align:center;
}ul{
display:inline-block;
text-align:left;
}
<div style="text-align:center;">
<h2 style="margin-top:43px;" class="text-center">Important years of life and work:</h2>
<ul >
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
</div>
答案 1 :(得分:0)
h2{
text-align:center;
margin-top:43px;
}
ul {
display: inline-block;
text-align: left;
padding: 0;
}
<div style="text-align:center;">
<h2>Important years of life and work:</h2>
<ul >
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
</div>