ASP. NET CSS Summary

Source: Internet
Author: User

1.asp.net referencing CSS 1.site.master inside set webopt 
    1. <webopt:bundlereferencerunat="server"path="~/Content/css"/>
2. Binding specific CSS in Bundle.config
  1. <? xml version = "1.0" encoding = "Utf-8" ?>
  2. <bundles version = "1.0" >
  3. <stylebundle path = "~/content/ CSS " >
  4. <include path = "~/content/ Bootstrap.css " />
  5. <includepath="~/Content/Site.css"/>
  6. </styleBundle>
  7. </bundles>
3. Of course, you can also directly on the specific pageexternal CSS referenced in the head
1 < Linktype = "Text/css" rel = "stylesheet" href = "External style sheet address" />

2.ASP. Various CSS styles in net

1. Write in style

    1. 1 < Asp:labelid = "Labelinf" runat = "Server" Text = "Work hard, drink a glass of water." "style=" Background-color: #222222; color: #3A87AD; height:38px;text-align:center;font-size:30px ;p adding:4px4px4px4px; " ></ Asp:label >

2 Some styles can be set directly        
    1. < Asp:labelid = "Label1" runat = "Server" Text = "Work hard, drink a glass of water." "ForeColor=" #3A87AD "BackColor=" #222222 "Height=" 38px "></asp:label>

3.CssClass
    1.  Span style= "color: #0000ff;" ><  asp:textboxid   runat  = "Server"  cssclass  = "Default input"  width  = "12%"  height  = "100%"  placeholder  = "Project ID nchar10"  validationgroup  = "2"  ></ asp:textbox  >  

       

    4.class
    1.  Span style= "color: #0000ff;" ><  asp:buttonid   runat  = "Server"  text  = "Project"  class  = "Btn btn-primary"  =" width:120px ;" onclick  = "Backproject_click"  causesvalidation  = "false"  ></ asp:button  >  

       

Ps:if CssClass and class exist at the same time, CssClass takes precedence.     style properties that are set directly on an ASP. NET control are converted to CSS styles.         ASP. NET controls internally advocate the use of CssClass 3. Modifying HTML control CSS in ASP.

1. In the foreground, set the control to Runat=server

    1. < Divstyle = "width:100%;" ID = "Div_hz" runat = "Server" >

2. Making changes in the background

    1. Div_hz. style["height"]="480px";

4.asp.net Modify font references to save Google fonts 1. The first two days found that web page refresh took a long time to request fonts.googleais.com,2.360 launched the Font acceleration service Fonts.useso.com3. In Bundle.config view and confirm the main referenced CSS file 4. Locate the corresponding CSS file under the Content folder 5. The CSS file Fonts.googleapis.com, replaced by fonts.useso.com PS: The recent discovery of salvation has no effect.

5.CSS Style sheet Overlay Order 1.The more precise the element selector selection of a style sheet, the higher the style precedence:The ID selector Specifies the style of the > class selector specified by the style > element type selector for the specified style 2. For styles developed by the same type selector, the higher the precedence in the style sheet file, the better it is to note that this is the higher priority in the style sheet file, rather than the order in which the element class appears. For example. Class2 appears in the style sheet after the. Class1:
    1. {color: black;}  {color: red;}

When an element is specified as class, it is specified in class= "Class2 Class1", at which point the Class1 is followed by Class2 when specified in the element, but because Class1 in the style sheet file is in front of Class2, At this point, the Class2 is still a higher priority, and the color property is red, not black. 3. If you want a style to have a higher priority, you can use the!importantTo specify:
    1. {color: black!important;}  {color: red;}
At this point, the class will use black rather than red. From for notes (Wiz)

ASP. NET CSS Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.