http://oi62.tinypic.com/33lo87l.jpg我應該如何設置文字位置?
導航和條幅都是在一個文件中。 'banner.php'
我想定位除登錄導航之外的「登錄成功」文本!
我試過margin-top:0px;但其仍banner.php的內容後顯示
我的CSS:
#container{
background-color:white;
margin-left:auto;
margin-right:auto;
width:800px;
height:auto;
}
#content_container{
background-color:red;
text-align:left;
margin-top:0px;
margin-left:155px;
}
body {
background-image:url(thebackground.png);
width:100%;
}
這是HTML代碼:
Banner.php的<div id="container">
<?php include 'banner.php'; ?>
<div id="content_container">
<h1>Login Successful <?php echo $_SESSION['username']?></h1>
</div>
</div>
CSS代碼:
<style>
#nav
{
margin-left:auto;
width:800px;
}
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:none;}
a:active {text-decoration:none;}
#tbl1
{
font-family: Calibri;
border-collapse:collapse;
border:1px solid #b9ccdc;
}
#tbl1 td
{
font-size:15px;
border:1px solid #b9ccdc;
}
#tbl1 th
{
font-size:17px;
height:32px;
width:150px;
background: -moz-linear-gradient(#6298c2, #82b2d8);
color:#f7fbff;
}
tr:hover
{
background: #deeaf4;
}
</style>
顯示「banner.php」的內容 – Cyclonecode
我已更新帖子。 – user3545779
使用['float:left'](http://www.w3schools.com/cssref/pr_class_float.asp)作爲菜單並給它'width'。否則,'div'被設置爲'display:block',它的寬度爲100%。 – machineaddict