【问题标题】:Text wont align right文本不会右对齐
【发布时间】:2013-06-17 11:15:11
【问题描述】:

我的文字无法正确对齐:

    #login_status
    {
           font-size: 1.2em;
           text-align: right;
           display: block;
           float:right;

    }

这是另一个相关的 css:

    #logo 
    {
           position: absolute;
           top: 15%;
           margin-left: 1em;
    }

    #login_status
    {
           font-size: 1.2em;
           text-align: right;
           display: block;
           float:right;

    }

    #header_container
    {
        background: #7fc041;
        height: 7.4em;
        left: 0;
        right: 0;
        position: fixed;
        width: 100%;
        top: 0;
    }

    #header_text 
    {
        margin-left: 9.75em;
        font-size: 2em;
        color: White;
        font-style: italic;
    }

和 html/server 控件:

<div id="header_container">        
    <div id="header">
        <div id="headerBar">
            <img src="images/logo.png" id="logo"/> 
            <span id="header_text">Scrum Reports</span>
      <asp:LoginStatus ID="LoginStatus1" runat="server" CssClass="login_status" />
        </div>
    </div>
</div>

【问题讨论】:

  • 您应该提供输出给客户端的html
  • 您的 HTML 中没有 ID login_status,但是您有一个类 .login_status
  • 除了提供最终的 HTML,我假设 CssClass 输出一个 class 属性。因此,您可能希望将 CSS 中的 #login_status 更改为:.login_status

标签: html asp.net css visual-studio-2010


【解决方案1】:

好吧,我不是 asp.net 专家,但我看到你使用 #login_statustext-align: rightCssClass="login_status",在我看来它会输出

<div class="login_status">

因此,您应该将#login_status 更改为.login_status,或者让它设置id 而不是类,因为样式似乎很好。

http://jsfiddle.net/ExplosionPIlls/mzUTW/

【讨论】:

    猜你喜欢
    • 2013-07-23
    • 2012-04-06
    • 1970-01-01
    • 1970-01-01
    • 2011-05-13
    • 2012-06-29
    • 2020-01-26
    • 2013-03-03
    • 1970-01-01
    相关资源
    最近更新 更多