2015-02-11 102 views
0

如何对齐在头右​​侧的股利,左边和中间

.header-cont 
 
{ 
 
\t width: 100%; 
 
\t position: fixed; 
 
\t top: 0px; 
 
} 
 
.header 
 
{ 
 
\t height: 50px; 
 
\t background: #f0f0f0; 
 
\t border: 1px solid #ccc; 
 
\t width: 80%; 
 
\t margin: 0px auto; 
 
\t line-height: 0px; 
 

 
} 
 
.maindiv 
 
{ 
 
\t box-shadow: 15px 0px 10px -11px rgba(0, 0, 0, 0.1), -15px 0px 10px -11px rgba(0, 0, 0, 0.1); 
 
\t width: 960px; 
 
\t background: #f0f0f0; 
 
\t border: 1px solid #ccc; 
 
\t height: 2000px; 
 
\t margin: 70px auto; 
 
\t 
 
} 
 
label { 
 
    float: left; 
 
    width: 15%; 
 
    margin-top: .5%; 
 

 
} 
 

 
form ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
} 
 

 
form ul li { 
 
    clear: both; 
 
    margin-top:2%; 
 
    
 
}
<html> 
 
<body> 
 
<!-- Star Here Top Title Bar --> 
 
<div class="header-cont"> 
 
<div class="header"> 
 
<form> 
 
    <ul> 
 
     <li> 
 
     <div> 
 
Here is the logo want to b in left corner 
 
     <label> 
 
      <img src=""> <!-- Logo in left side corner--> `enter code here` 
 
     </label> 
 
     <div> 
 
     <div > 
 
Here is the profile picture i want to b it in center 
 
     <label> 
 
      <img src=""><!-- Profile Picture in center --> 
 
     </label> 
 
     </div> 
 
Here is user name wnt to be in right side 
 
     <label> 
 
      <a href="" id="welcome">Welcome User!!</a><!-- Right Side--> 
 
     </label> 
 
Login and sign up want to b in Right corner 
 
     <label> 
 
      <a href="#">Login</a><!-- Right Side Corner--> 
 
      <a href="#">Signup</a> 
 
     </label> 
 
     </li> 
 
    </ul> 
 
</form> 
 
</div> 
 
</div> 
 
<div class="maindiv"> 
 
<h1>This is Content Page</h1> 
 
</div> 
 

 
</body> 
 
</html>

Thiz is output of the program, i want to change this header

+0

你能解释一下右边和右上角之间的区别?你的意思是右上角吗? – Giorgio 2015-02-11 10:51:24

回答

0

根据您的需要更改宽度。

.container{ 
 
     width:100%; 
 
    } 
 

 
    .left { 
 
    \t float:left; 
 
     width:33.33%; 
 
    \t text-align: left; 
 
    \t 
 
    } 
 
    .center { 
 
    \t display: inline-block; 
 
     margin:0 auto; 
 
     width:33.33%; 
 
     text-align: center; 
 
    } 
 

 
    .right { 
 
    \t float:right; 
 
     width:33.33%; 
 
    \t text-align: right; 
 
    }
<div class="container"> 
 
<div class="left"><!-- left contents --> </div> 
 
<div class="center"><!-- center contents --> </div> 
 
<div class="right"><!-- right contents --> </div> 
 
</div>

0

取3 <div>给他们的ID和width:33.33%;float:left;

第一DIV把你的标志内,第二次放置个人资料照片,第三次再拍两张<div>width:50%;,欢迎用户设置text-align:left;和用于登录和注册集text-align:right;

相关问题