css - 请教,底部浮动为什么去除不了?还有也不能居中显示!
本文介绍了css - 请教,底部浮动为什么去除不了?还有也不能居中显示!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
有人提醒,我改动了一点排版,现在想把<div id=footer>这个块级元素内的文字放入底部居中显示,由于前面的一些效果我是用了float样式。最后在#footer的样式设计里用了clear:both,但没效果而且用了text-align:center 文字也没有居中显示。在HTML里也修改了但是达不到想要的效果。图1,图2是我的效果,图3是想要的效果。
图1
图2
图3
html文件
<html xmlns="http://www.w3.org/1999/xhtml&...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>自己设置的第一个页面</title>
<link href="StyleSheet2.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="container">
<div id="header"></div>
<div id="=footer">
<p class="content">
<a href="#" target="_blank">首页</a>
<a href="#" target="_blank">网站</a>
<a href="#" target="_blank">文章</a>
<a href="#" target="_blank">作者</a>
<a class="last" href="#" target="_blank">投递</a>
</p>
<p>
Copyright (C) 2016 || <a href="http://www.google.com" target="_blank">谷歌学术</a>
</p>
</div>
</加粗文字div>
</body>
</html>
Css文件代码
-
{
margin: 0px; padding: 0px;
}
......此处省略
footer p.content{
background-color: blue;
clear: both;
text-align: center;
}
footer p{
background-color: blue;
clear: both;
text-align: center;
}
footer p a.last {
margin:0;
}
解决方案
其他先不管,我帮你看了一下,<div id="=footer">
这个明显错了,应该是<div id="footer">
,
然后css的话footer p.content
,footer前面少了#,
clear:both的话,#footer{clear:both}
;
对了,footer下面的a记得设置白色字体。
这篇关于css - 请教,底部浮动为什么去除不了?还有也不能居中显示!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文