我想知道如何获得3列文本在同一行与3个标题类似。
我已经尝试过在类中添加div,尽管我可能犯了错误,但是使用文本对齐选项似乎不起作用。
这个网站有3列文本与3个标题,是我想要的布局,但我有麻烦的代码。
谢谢你们的帮助
发布于 2015-09-02 05:27:50
下面是HTML:
<div id="first">
this is first div with first text
</div>
<div id="second">
this is second div with second text
</div>
<div id="third">
this is third div with third text
</div>
这是CSS:
#first{
--background:black;
text-align:left;
width:100px;
height:100px;
float:left;
color:orange;
}
#second{
--background:orange;
text-align:center;
width:100px;
height:100px;
float:left;
color:blue;
margin-left:20px;
}
#third{
--background:blue;
text-align:right;
width:100px;
height:100px;
float:left;
color:orange;
margin-left:20px;
}
这就是我从你的问题中得到的一切!您可以根据需要修改此代码。
发布于 2015-09-02 05:28:43
Div是一个块元素,所以文本别名不会影响这一点。例如,HTML:
<div class="wrapper">
<div class="test">
<p>Some text</p>
</div>
<div class="test">
<p>Some text</p>
</div>
<div class="test">
<p>Some text</p>
</div>
</div>
CSS:
.wrapper { width: 800px; }
.wrapper .test { width: 200px; display: inline-block; margin: 0 20px; }
.wrapper .test p { text-align: justify; }
https://stackoverflow.com/questions/32354051
复制