<rdf:RDF
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xml:base='http://wiki.marandcustomsolutions.com/rdf'>
    <s:Snip rdf:about='http://wiki.marandcustomsolutions.com/rdf#Development/Cascading+Style+Sheets'
         s:cUser='mpecher'
         s:oUser=''
         s:mUser='mpecher'>
        <s:name>Development/Cascading Style Sheets</s:name>
        <s:content>__Good Online Reference (some material taken from here)__ {link:w3schools|http://www.w3schools.com/css/css_syntax.asp}&#xD;&#xA;----&#xD;&#xA;1 How to Insert a Style Sheet&#xD;&#xA;1.1 External Stylesheet&#xD;&#xA;{code}&#xD;&#xA;&lt;head&gt;&#xD;&#xA;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;mystyle.css&quot; /&gt;&#xD;&#xA;&lt;/head&gt;&#xD;&#xA;{code}&#xD;&#xA;1.1 Internal Stylesheet&#xD;&#xA;{code}&#xD;&#xA;&lt;head&gt;&#xD;&#xA;&lt;style type=&quot;text/css&quot;&gt;&#xD;&#xA;hr {color: sienna}&#xD;&#xA;&lt;style&gt;&#xD;&#xA;&lt;/head&gt;&#xD;&#xA;{code}&#xD;&#xA;1.1 Inline Styles&#xD;&#xA;{code}&#xD;&#xA;&lt;p style=&quot;color: sienna; margin-left: 20px&quot;&gt;This is a paragraph&lt;/p&gt;&#xD;&#xA;{code}\\&#xD;&#xA;----&#xD;&#xA;\\&#xD;&#xA;{code}&#xD;&#xA;Three levels of defining a style:&#xD;&#xA;1: HTML element (ie override all &lt;p&gt;&#xD;&#xA;2: class (.something). All elements of that class&#xD;&#xA;3: id (#something). This should be unique per page&#xD;&#xA;&#xD;&#xA;{code}\\&#xD;&#xA;&#xD;&#xA;1 CSS Syntax&#xD;&#xA;The CSS syntax is made up of three parts: a selector, a property and a value:&#xD;&#xA;{code}&#xD;&#xA;selector {property: value}&#xD;&#xA;{code}&#xD;&#xA;The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon and surrounded by curly braces:&#xD;&#xA;{code}&#xD;&#xA;body {color: black}&#xD;&#xA;{code}&#xD;&#xA;If  the value is multiple words, put quotes around the value:&#xD;&#xA;{code}&#xD;&#xA;p {font-family: &quot;sans serif&quot;}&#xD;&#xA;{code}&#xD;&#xA;Note: If you wish to specify more than one property, you must separate each property with a semi-colon. The example below shows how to define a center aligned paragraph, with a red text color:&#xD;&#xA;{code}&#xD;&#xA;p {text-align:center;color:red}&#xD;&#xA;{code}&#xD;&#xA;To make the style definitions more readable, you can describe one property on each line, like this:&#xD;&#xA;{code}&#xD;&#xA;p&#xD;&#xA;{&#xD;&#xA;text-align: center;&#xD;&#xA;color: black;&#xD;&#xA;font-family: arial&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Grouping&#xD;&#xA;&#xD;&#xA;You can group selectors. Separate each selector with a comma. In the example below we have grouped all the header elements. All header elements will be green:&#xD;&#xA;{code}&#xD;&#xA;h1,h2,h3,h4,h5,h6 &#xD;&#xA;{&#xD;&#xA;color: green&#xD;&#xA;&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 The class Selector&#xD;&#xA;&#xD;&#xA;With the class selector you can define different styles for the same type of HTML element. Say that you would like to have two types of paragraphs in your document: one right-aligned paragraph, and one center-aligned paragraph. Here is how you can do it with styles:&#xD;&#xA;{code}&#xD;&#xA;p.right {text-align: right}&#xD;&#xA;p.center {text-align: center}&#xD;&#xA;{code}&#xD;&#xA;You have to use the class attribute in your HTML document:&#xD;&#xA;{code}&#xD;&#xA;&lt;p class=&quot;right&quot;&gt;&#xD;&#xA;This paragraph will be right-aligned.&#xD;&#xA;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p class=&quot;center&quot;&gt;&#xD;&#xA;This paragraph will be center-aligned.&#xD;&#xA;&lt;/p&gt;&#xD;&#xA;{code}&#xD;&#xA;Note: Only one class attribute can be specified per HTML element! The example below is wrong:&#xD;&#xA;{code}&#xD;&#xA;&lt;p class=&quot;right&quot; class=&quot;center&quot;&gt;&#xD;&#xA;This is a paragraph.&#xD;&#xA;&lt;/p&gt;&#xD;&#xA;{code}&#xD;&#xA;You can also omit the tag name in the selector to define a style that will be used by all HTML elements that have a certain class. In the example below, all HTML elements with class=&quot;center&quot; will be center-aligned:&#xD;&#xA;{code}&#xD;&#xA;.center {text-align: center}&#xD;&#xA;{code}&#xD;&#xA;In the code below both the h1 element and the p element have class=&quot;center&quot;. This means that both elements will follow the rules in the &quot;.center&quot; selector:  &#xD;&#xA;{code}&#xD;&#xA;&lt;h1 class=&quot;center&quot;&gt;&#xD;&#xA;This heading will be center-aligned&#xD;&#xA;&lt;/h1&gt;&#xD;&#xA;&#xD;&#xA;&lt;p class=&quot;center&quot;&gt;&#xD;&#xA;This paragraph will also be center-aligned.&#xD;&#xA;&lt;/p&gt; &#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;__~~* Do NOT start a class name with a number! It will not work in Mozilla/Firefox.~~__&#xD;&#xA;&#xD;&#xA;1 The id Selector&#xD;&#xA;&#xD;&#xA;With the id selector you can define the same style for different HTML elements.&#xD;&#xA;&#xD;&#xA;The style rule below will match any element that has an id attribute with a value of &quot;green&quot;:&#xD;&#xA;{code}&#xD;&#xA;#green {color: green}&#xD;&#xA;{code}&#xD;&#xA;The rule above will match both the h1 and the p element:&#xD;&#xA;{code}&#xD;&#xA;&lt;h1 id=&quot;green&quot;&gt;Some text&lt;/h1&gt;&#xD;&#xA;&lt;p id=&quot;green&quot;&gt;Some text&lt;/p&gt;&#xD;&#xA;{code}&#xD;&#xA;The style rule below will match a p element that has an id with a value of &quot;para1&quot;:&#xD;&#xA;{code}&#xD;&#xA;p#para1&#xD;&#xA;{&#xD;&#xA;text-align: center;&#xD;&#xA;color: red&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;The style rule below will match any p element that has an id attribute with a value of &quot;green&quot;:&#xD;&#xA;{code}&#xD;&#xA;p#green {color: green}&#xD;&#xA;{code}&#xD;&#xA;The rule above will not match an h1 element:&#xD;&#xA;{code}&#xD;&#xA;&lt;h1 id=&quot;green&quot;&gt;Some text&lt;/h1&gt;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;__~~* Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.~~__&#xD;&#xA;&#xD;&#xA;1 CSS Comments&#xD;&#xA;You can insert comments into CSS to explain your code, which can help you when you edit the source code at a later date. A comment will be ignored by the browser. A CSS comment begins with &quot;/*&quot;, and ends with &quot;*/&quot;, like this:&#xD;&#xA;{code}&#xD;&#xA;/* This is a comment */&#xD;&#xA;p&#xD;&#xA;{&#xD;&#xA;text-align: center;&#xD;&#xA;/* This is another comment */&#xD;&#xA;color: black;&#xD;&#xA;font-family: arial&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;---&#xD;&#xA;1 Change hyperlinks when selecting&#xD;&#xA;Most sites seem to change the link once the mouse hovers over it. A lot of Vision compliancy also requires that this same behavious is replocated if tabbing through the links via the keyboard.&#xD;&#xA;{code}&#xD;&#xA;.someStyle a:hover, .someStyle a:focus, .someStyle a:active {&#xD;&#xA;    text-decoration: underline&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;First style causes hover with mouse, :focus tells mozilla to also highlight during tabbing, while :active is for IE to react during a tab.&#xD;&#xA;&#xD;&#xA;1 Changing the Look of Input Buttons&#xD;&#xA;Set the CSS for __input[type=submit]__. This does not work for IE though. It does not currently recognise it.\\&#xD;&#xA;To make it work for all browsers, need to define a custom class for a button and define it at that level. eg:&#xD;&#xA;{code}&#xD;&#xA;.buttons {&#xD;&#xA;    padding: 0px 5px 1px 5px;&#xD;&#xA;    margin: 0px 3px 0px 3px;&#xD;&#xA;    background: #3165CE;&#9;&#xD;&#xA;    color: #FFFFFF;&#xD;&#xA;    border: none;&#xD;&#xA;    cursor: pointer;&#xD;&#xA;    font-size: 12px;&#xD;&#xA;    font-weight: bold;&#xD;&#xA;    text-align: center;&#xD;&#xA;    font-family:  Verdana, Arial, Helvetica, sans-serif;&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Cases where Internet Explorer doesn&apos;t accept something, this can be overriden:&#xD;&#xA;{code}&#xD;&#xA;#RightImage&#xD;&#xA;{&#xD;&#xA;float: right;&#xD;&#xA;max-width: 400px;&#xD;&#xA;max-height: 400px;&#xD;&#xA;margin: 10px 10px 10px 10px;&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;#LeftImage&#xD;&#xA;{&#xD;&#xA;float: left;&#xD;&#xA;max-width: 400px;&#xD;&#xA;max-height: 400px;&#xD;&#xA;margin: 10px 10px 10px 10px;&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;/* fix IE (doesn&apos;t like max-width and max-height)*/&#xD;&#xA;*html #RightImage, #LeftImage&#xD;&#xA;{&#xD;&#xA;width: 400px;&#xD;&#xA;height: 300px;&#xD;&#xA;}&#xD;&#xA;{code}</s:content>
        <s:mTime>2007-12-22 13:53:36.0</s:mTime>
        <s:cTime>2006-02-09 12:08:25.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Javascript/Hide/Show Div'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='#Development'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Version Control Systems/ClearCase/ConfigSpec'/>
                <rdf:li rdf:resource='#accenture'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Linux/Understanding memory usage'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Trailer Wiring'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Java &amp; J2EE/Appfuse/Tips/Branding'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Entity Relationship Diagram'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Java &amp; J2EE/Websphere/Portal/themes'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Java &amp; J2EE'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Testing/junit'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Java &amp; J2EE/Appfuse/Tips/ThemeColor'/>
                <rdf:li rdf:resource='http://wiki.marandcustomsolutions.com/rdf#Development/Javascript'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>

