2013-04-23 61 views
1

内的按钮这里是我的登录页面:enter image description here定位锚元素和标签

对不起,我试图张贴的jsfiddle我的代码,但它搅乱它大的时候......

反正...这里是我的HTML和CSS:

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>Território Levita</title> 
    <link type="text/css" rel="stylesheet" href="css/StyleSheet1.css" /> 
    <script src="js/JavaScript1.js"></script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
     <header class="headerLogin"> 
      <h1>Território Levita</h1> 
     </header> 
     <div class="boxLogin"> 
      <h1>Área de Login</h1> 
      <label> 
       <span>Usuário: </span> 
       <asp:TextBox runat="server" ID="txtUsuario" CssClass="inputText" ></asp:TextBox> 
      </label> 

      <label> 
       <span>Senha: </span> 
       <asp:TextBox runat="server" ID="txtSenha" TextMode="Password" CssClass="inputText"></asp:TextBox> 
      </label> 

      <label id="labelBtn"> 
       <a href="#">Cadastre-se</a> 
       <a href="#">Esqueci minha senha</a> 
       <asp:Button runat="server" CssClass="btn" ID="btnLogar" Text="Entrar" /> 
      </label> 

     </div> 
    </form> 
</body> 
</html> 


* { /*Zerando margin e padding global.*/ 
    margin: 0px; 
    padding: 0px; 
} 

body { /*Estilo de body*/ 
    background-color: #fff; 
} 

.inputText { /*Zerando padding dos inputs*/ 
    padding: 0px; 
} 

.headerLogin { /*Área de login*/ 
    width: 95%; 
    background-color: #67BCDB; 
    margin: 10px auto 150px auto; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px; 
    border-radius: 5px; 
    height: 100px; 
    line-height: 100px; 
    position: relative; 
    -moz-box-shadow: 0 0 10px #4e707c; /*Sombra Firefox*/ 
    -webkit-box-shadow: 0 0 10px #4e707c; /*Sombra chrome*/ 
    box-shadow: 0 0 10px #4e707c; 
} 

    .headerLogin h1 { /*Texto do cabeçalho*/ 
     color: #fff; 
     text-transform: uppercase; 
     margin-left: 20px; 
     display: inline-block; 
    } 


.boxLogin { /*Estilo da área de login*/ 
    -moz-border-radius: 5px; /*Firefox*/ 
    -webkit-border-radius: 5px; /*Chrome*/ 
    border-radius: 5px; /*IE*/ 
    border: 8px solid #eee; 
    -moz-box-shadow: 0 0 10px #4e707c; /*Sombra Firefox*/ 
    -webkit-box-shadow: 0 0 10px #4e707c; /*Sombra chrome*/ 
    box-shadow: 0 0 10px #4e707c; /*Sombra IE*/ 
    margin: 0px auto; 
    width: 500px; 
    position: relative; 
} 

    .boxLogin h1 { /*Estilo do cabeçalho*/ 
     font-weight: normal; 
     font-size: 22px; 
     text-align: center; 
     background-color: #67BCDB; 
     color: #fff; 
     text-transform: uppercase; 
     padding: 2px 2px 2px 2px; 
     margin-bottom: 10px; 
     height: 50px; 
     line-height: 50px; 
    } 

    .boxLogin label { /*Container dos controles*/ 
     display: block; 
     width: 90%; 
     background-color: #dbd8d8; 
     margin: 0 auto 10px auto; 
     -moz-border-radius: 6px; /*Firefox*/ 
     -webkit-border-radius: 6px; /*Chrome*/ 
     border-radius: 5px; /*IE*/ 
     padding: 1px 1px 1px 1px; 
    } 

    .boxLogin span { /*Estilo do texto (usuário e senha)*/ 
     float: left; 
     width: 60px; 
     text-align: left; 
     margin-left: 5px; 
     font-size: 1.2em; 
     letter-spacing: 1px; 
     font-family: 'Bitstream Vera Sans Mono'; 
     font-weight: normal; 
    } 

    .boxLogin .inputText { /*Estilo dos inputs*/ 
     width: 200px; 
     padding: 5px; 
     margin-top: 1px; 
     margin-bottom: 1px; 
     margin-left: 150px; 
    } 

    .boxLogin #labelBtn { /*Container do botão*/ 
     background: #fff; 
     position: relative; 
     text-align: right; 

    } 

.btn { /*Estilo do botão*/ 
    background-color: #E44424; 
    padding: 7px; 
    -moz-border-radius: 6px; 
    -webkit-border-radius: 6px; 
    border-radius: 6px; 
    color: #fff; 
    -moz-box-shadow: 0 0 10px #4e707c; /*Sombra Firefox*/ 
    -webkit-box-shadow: 0 0 10px #4e707c; /*Sombra chrome*/ 
    box-shadow: 0 0 10px #4e707c; 
    cursor: pointer; 
    width: 150px; 
} 

#labelBtn .btn { 


} 

a { 
    text-decoration: none;     
} 

正如你所看到的,我有标签,作为我的跨度和asp.textboxes容器......这里的东西:我试图使标签与锚和按钮里面显示他们作为三个'块'相同的大小...每个33%...和按钮将是现在的确切位置。它是在正确的位置,因为我已经设置了它的父标签,将文本对齐设置为正确的......但它破坏了我的“每块大小相同的3个块”的计划......我怎么能使它发生?

还有一件事情....用于封装组件的标签或字段集?

回答

0

你的目的,“标签”,在HTML 5好比“格”,这样你就可以添加类和ID是同样的方式,你会为一个div:

如果你的盒子宽度不是动态调整,并假设你的“.boxLogin”的标签是180像素高,只是给每个标签的一类像“.heightSetter”,并在你的CSS加:

.heightSetter { 高度:60像素; float:right; }

这将给出所有的高度相同并浮动到封闭元素的右边。

确保在CSS中设置“.boxLogin”的“height”属性。