My page on CSS

Having documented my web design so far I thought it was time that I had a page on CSS itself. I have been using these techniques more and more and there is lot of information on the W3C Schools website.

To further my understanding of css I need to know what Selectors really are, what float means and how I have used paddings and margins. These are explained in the W3C Schools CSS Tutorial.

Also the "Object" nature of whole scheme. I was going to say OOP (Object Oriented Programming), but that is a topic for a whole other discussion. There is some things that I need to clarify (in my own mind at least) regarding inheritace, child and parent relationships between "items" in css.

I am using the term "items" to mean HTML Elements.

Selectors are discussed pretty early on in the CSS Schools tutorial, so I guess they are important. Colors (Colours), Backgrounds, Borders, Padding and Margins follow.

Universal Selectors

The Universal Seector is the * character. It can be used to select many elements, I am using it to select a box-sizing

Class Selectors and definitions

These are defined in the css file with a starting "." (full stop) - for example .header and .menu

Multiple Selectors

You can specify (define) single and multiple HTML Selectors and specify how they are to perform within a class.

For example .menu ul - .menu li and .menu li a

This means you can specify (as in my rwd.css file) the menu buttons. The ul has a list-style-type of none. The menu items .menu li have specified text and background colors - margins and padding - the text is aligned centrally and the buttons have a shadow.

Further to this the <a> (anchors) have no text-decoration and display as "block". Hover behaviour is also specified.

Above is an example of a single menu button taking its major style from rwd.css plus additional style to centre the button in the content and to set the width to 200px.

The W3C Schools website has many examples of alternative menu systems. Things have progressed a lot since I started with this research. There are examples of dropdowns implemented in CSS. I had looked at this in the past and decided not to go that way.

Attribute Selectors

An Attribute Selector in my main css file:
[class*="rcontent-"] {
float: left;
padding: 15px;
}

The essence of this is that I think that what happens here is that class with a Universal Selector (^) matches with "rcontent-". If it does the padding and the float are applied to the class.

If I float right the menu will appear on the right of the screen. I can also reduce the padding but I think 15px is about right.

What the W3C Spec/Recommendation says:

Selectors allow the representation of an element’s attributes. When a selector is used as an expression to match against an element, attribute selectors must be considered to match an element if that element has an attribute that matches the attribute represented by the attribute selector.

Heirarchy

Childred and parents - Specificity Hierarchy

I need to look at this!

Javascript and getting css to work

My responsive bottom menu and the expandable page sections have their css behaviour controlled by some Javascript.

Links

External Sources

My page on CSS