Thursday, 15 March 2012

html - Set styles per div -


I am new to CSS and not a programmer, I understand what a class is and I think what is a div But what I have not been able to know is to divide styles.

Any help appreciated,

Joost Verplancke

< P> In your HTML

  & lt; Div class = "MyClass" & gt; see me! & Lt; / Div & gt;  

In your CSS

  .myclass {background-color: # aaa; }   

Edit

As told by Dave, you can provide multiple classes for one element. This means that you can essentially make modular styles

for example, in your HTML

   

In your CSS

  .myclass {background-color: # aaa; Color: # 1dd; }. MyColor {color: # 111; }  

You should also note that the order attribute in the class attribute has conflicting settings in different styles. That is, class = "myClass myColor" is exactly the same as class = "mycolor myClass" . Which contradictory setting is actually used in CSS.

This means, instead of forming myClass from color in the above example, colors to myColor , you have to change your CSS to switch around it

  .mycolor {color: # 111; }. MyClass {background-color: #by; Color: # 1dd; }  

No comments:

Post a Comment