Beef Brisket Press Release System: Web Forms cannot display applied style sheets

Preface

When knocking on the sirloin, we need to create a style sheet so that similar functional windows can apply the same style sheet.

1. Problem description and solution

After editing the style sheet and applying it to the Web form, the web page cannot display the applied style.

Style sheet:

#top, #search {/*公共样式*/
    width: 760px;
    margin:10px auto 10px auto;
}

 Wrong web form content


        <div id=" top">
            <a href ="http://www.tg029.com " ><img src="images/niunanlogo.jpg" /></a>                
        </div>
        <div id=" search">
        搜索条件:            
            <asp:TextBox ID="txtKey" runat="server"></asp:TextBox>
            <asp:ImageButton ID="ibtnSearch" ImageUrl="images/search.gif"  runat="server" />
        </div>

Correct web form content


        <div id="top">
            <a href ="http://www.tg029.com " ><img src="images/niunanlogo.jpg" /></a>                
        </div>
        <div id="search">
        搜索条件:            
            <asp:TextBox ID="txtKey" runat="server"></asp:TextBox>
            <asp:ImageButton ID="ibtnSearch" ImageUrl="images/search.gif"  runat="server" />
        </div>

After comparison, it can be found that an extra space is written in the web form before the label top and search , which causes the style sheet to not be used normally.

Second, how to apply style sheets in Web Forms

1. First you can see the style sheet and Web form in the figure below

2. Application style:

(Method 1: Just drag the style sheet just below the title tag directly)

(Method 2: Copy the style sheet and paste it)

Application results:

3. Next, we can write the styles we need in the style sheet, for example:

#top, #search {/*公共样式*/
    width: 760px;
    margin:10px auto 10px auto;
}

Guess you like

Origin blog.csdn.net/weixin_44690047/article/details/115275952
Recommended