Difference between Class vs CSSClass in ASP.Net CSS + CSS syntax question

后端 未结 6 1522
挽巷
挽巷 2020-12-29 23:21

What is the difference between:

and

6条回答
  •  猫巷女王i
    2020-12-30 00:07

    ASP.Net CssClass is an abstract wrapper around the css "class" specifier.

    Essentially, for most intents and purposes, they are the same thing. When you set the CssClass property to some string like "someclass", the html that the WebControl will render will be class = "someclass".


    EDIT: The CSS selectors you have written are both "correct", but they do two different things. ".someclass th" matches any descendant th element of an element that has the "someclass" class. The second one matches the th element itself that has the "someclass" class.

    Hope that's clear. Regardless of the way you specify the class for the elements (using ASP.Net's CSSClass, or just setting the class), your CSS selectors will do the same thing. They don't have anything to do with ASP.Net specifically.

提交回复
热议问题