我正在尝试制作一个基本的三栏博客模板。左栏将被固定,标题在顶部,个人资料图片在其下方,导航链接在下面,而右侧的内容将滚动。我无法将标题放在左侧的div中;我认为在使用margin:0 auto和position:fixed列居中之间存在冲突。
的CSS
#container {
top: 0;
left: 0;
min-height: 100%;
min-width: 100%;
z-index: -99999;
}
#sideLeft-bar {
left: 0;
top: 0;
width: 300px;
min-height: 100%;
color: #646f7b;
background-color: #363f48;
position: relative;
position: fixed;
}
div#title {
width: 300px;
color: #FF4000;
font-size: 200%;
margin: 0 auto;
}
img#resize-profile {
width: 200px;
height: auto;
padding: 170px 20px 0 40px;
z-index: 99999;
position: fixed;
}
div#nav-left {
padding: 400px 20px 40px 40px;
color: #646f7b;
font-size: 125%;
margin: 0 0 0.75 0;
line-height: 1.25em;
position: absolute;
position: fixed;
}
.content {
position: absolute;
width: 650px;
left: 300px;
padding: 30px;
color: #505050;
font-size: 100%;
line-height: 1.5em;
}
的HTML
<div id="container"> <!--BEGIN OUTER DIV-->
<div id="sideLeft-bar">
<div id="title">
<p>
Love Sosa
</p>
</div>
</div> <!--creates fixed sidebar-->
<img id="resize-profile" src="images/profile.png">
<div id="nav-left">
<ul>
<li>These</li>
<li>Skitches</li>
<li>Love</li>
</ul>
</div>
<div class="content">
<p>
some content
</p>
</div>
<div id="sideRight-bar">
Stuff in here
</div>
</div>
一些注意事项:
1.)这将是用户注册博客时唯一可用的模板。我使用太多固定位置的原因是,我不希望内容移动任何位置(例如:一个人的标题占据了两行,我不希望其个人资料图片和导航向下移动)
2.)内容(标题,个人资料图片,导航链接)直接通过sideBar-left定位,但我给了它们
3.)我将从头开始重新尝试,然后再试一次,但是我想知道要往哪个方向前进,因为浮动,位置以及位置如何中断边距正在困扰着我。
以下是其外观的屏幕截图:https : //www.dropbox.com/s/2m394zjtdj5505k/Screenshot%202014-02-17%2011.32.09.png
text-align: center
的 div#title
div#title {
width: 300px;
color: #FF4000;
font-size: 200%;
margin: 0 auto;
text-align: center;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句