john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

css basics class override priority

CSS Classes and overrides example

<HTML><HEAD>

<!-- LINK REL=stylesheet HREF="mystyles.css" TYPE="text/css" --> 
<style type="text/css">
H1 { color: blue; font-size: 37px; font-family: impact }
P.first { text-indent: 1cm; background: yellow; font-family: courier }
p.second {color: red }  /* the second class */

B { color: blue }  /*bold is set to blue*/
.third {color: green }  
p b {color: red}   /* when a bold is in a paragraph gets turned red*/
</style>

</HEAD>
<BODY>
<H1>css header font</H1>
<P>paragraph</P>
<p class="first">first class</p>
<p class="second">paragraph with second class</p>

<b> <i> inheritance</i> demo </b>
<b class="third">"floating class third</b>
<i class="third">third applied to italic</i>
<p class="third">third overrides paragraph</p>
<p class="first"> combination <b>interesting</b> </p>

    Hierarchy for what style applies in a conflict:
<pre>
   1. Inline styles
   2. Embedded styles
   3. Linked styles
   4. Imported styles
   5. Default browser styles 
</pre>

</BODY></HTML>

  • « win wchar from char mbstowcs string to windows
  • win errors try except »

Published

May 17, 2010

Category

css

~124 words

Tags

  • basics 8
  • class 4
  • css 19
  • override 4
  • priority 1