[英]CSS Header alignment on the same line
我有两个标题要显示在同一行上,但一个在左侧,一个在右侧。 做这个的最好方式是什么?
HTML:
<h2 style="color: green" style="text-align : center">Approved</h2><h4>Count: </h4>
CSS:
h2 {
font-size: 11.5pt;
font-family: Georgia;
display: inline;
}
h1 {
margin: 0.5em 0 0.5em 0;
padding: 0.5em 0 0.5em 10px;
font-size: 12pt;
font-family: Georgia;
color: white;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
display: inline;
}
您可以向每个标头添加float
属性,例如:
h2 { float: left; }
和
h1 { float: right }
您可以使用浮点数。
h2 {
font-size: 11.5pt;
font-family: Georgia;
display: inline;
float:right;
}
h1 {
margin: 0.5em 0 0.5em 0;
padding: 0.5em 0 0.5em 10px;
font-size: 12pt;
font-family: Georgia;
color: white;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
display: inline;
float:left;
}
尝试这个
<div class="first"><h1 style="color: green" style="text-align : center">Approved</h1><h2>Count: </h2></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.