所以我有一个页面,我试图将我所有的链接放在一个单独的 HTML 文件中,我的计划是使用 iFrame 轻松地将链接列表添加到每个页面,以便更改我只需要更改的链接一个文件。我的问题是,在使用 iFrame 后,其他文本没有显示在我的页面上......这是我的代码:
首页:
<html>
<head><title>HTML Tutorial</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="navigationLinks"><iframe src="links.html" height="100%" width="10%" seamless></iframe></div>
<div id="mainBody">Hello World</div>
</body>
</html>
CSS 页面:
body {
}
.navigationLinks, .navigationLinks a:link {
float:left;
margin-left: 0px;
margin-right: 80%;
font-family: impact;
}
.mainBody {
float:center;
margin-left: 22%;
margin-right: 22%;
color:black;
}
我的 mainBody 文本没有显示。有什么想法吗?
最佳答案
修复:
.mainBody {
float:left;
width:100%;
display:block;
margin-left: 22%;
margin-right: 22%;
color:black;
text-align:center;
}
顺便说一句,没有float: center
关于css - HTML iFrame 不显示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22431986/