请快速查看此链接:
如您所见,文本底部与页面左侧对齐
我想在页面右侧添加与现有文本内嵌的文本。
这是怎么做到的?
我发现很难对齐所有这些 div!
谢谢大家!
詹姆斯
最佳答案
您可以像这样轻松地重写所有内容以容纳页脚 id 内的两个区域(左和右):
HTML
<html>
<head>
<link href="test.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="footer" style="position:absolute;bottom:0;">
<div class="left">
<a href="#">About Us</a>
<a href="#">Accessibility</a>
<a href="#">Recruiters</a>
<a href="#">Contact Us</a>
</div>
<div class="right">
<a href="#">About Us</a>
<a href="#">Accessibility</a>
<a href="#">Recruiters</a>
<a href="#">Contact Us</a>
</div>
</div>
</body>
</html>
CSS
body {
margin: 0;
padding: 0;
}
#footer {
background: #FFFFFF;
border: 1px solid;
color: #e6e6e6;
height: 30px;
width: 960px;
position:absolute;
float: left;
margin: 0px 0px 0px 0px;
padding:0;
}
#footer a {
font: 13px helvetica;
color: #0040FF;
padding: 8px 12px 3px 3px;
}
#footer a:hover {
font: 13px helvetica;
color: #0040FF;
padding: 8px 3px 3px 3px;
text-decoration: underline;
}
.right {
float:right;
}
.left {
float:left;
}
演示
-- 编辑
更改了 fiddle 以更好地适应您的悬停状态。
关于css - 添加另一个 div 时如何使 div 内联?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7807405/