【发布时间】:2014-07-07 16:30:12
【问题描述】:
我有一个真正的问题,我确信这只是因为我没有长时间编码,很容易忽略简单的错误。 我正在尝试将地址居中,并尝试将其包含在 div 中,或者只是自行格式化,但我无法将其居中。 请注意,我希望地址固定在屏幕上,所以滚动时它不会移动。 这是我的代码(我知道每个人都讨厌粘贴大段代码的人,但我还没有学会如何链接我的 jsfiddle 页面)
<link rel="stylesheet" href="stylesheet for real index.css">
</style>
<head>
<title>Test of notepad ++</title>
</head>
<body>
<div style="text-align: center;height: 100%;background: #4FD5D6;">
<iframe src="index.html" scroll="no">Your browser doesn't support iFrames.</iframe>
</div>
<div class="center">
<address>
Made by <em><b>Dantoon e</b></em><br>So look out
</address>
</div>
</body>
还有CSS
body {
font-family: Nobile;
background-color: #4FD5D6;
display: empty-cells; }
iframe {
display: block !important;
width: 1200px;
height: 1200px;
margin-top: -20px;
margin-right: auto;
margin-left: auto;
margin-bottom: -1000px;
box-shadow: 10px 10px 10px;
position: relative;
z-index: 0; }
.center {
border-top: thick dotted;
border-bottom: thick dotted;
background-color: black;
color: white;
position: fixed;
bottom: 5px;
width: 1204px;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-bottom:5px;
display: inline;
margin-top: 0px;
z-index: 1; }
我只包含整个页面,因为我不知道其他地方的疏忽可能会影响地址。谢谢提前!
【问题讨论】:
-
如果就是这样,我会踢自己
-
不,仍然无法正常工作,不过感谢您的帮助,不敢相信我做到了!
-
我并不是说作为一种解决方案,只是一个注释。
.center元素的宽度不应该是 100% 而不是 1204px? -
width: 100% 导致地址跨越网站的整个宽度,它应该与 iframe 对齐