Cascading Style Sheets
This is my main start page for CSS discussion. Unlike sites such as W3C Schools and Microsoft Developers Network tempusfugit is not intended as a complete (alphabetical and indexed) guide to website development. Many topics have pages on this website that were created pretty much as I became aware of the techniques involved.
My initial emphasis was on how to manipulate the DOM by selecting items and changing them programatically with JavaScript.
You may have come to this page after making an Internet search and followed a link from the page that you found when making the search. If this is the case you may find the information that you are looking for by following a link below.
Who knew? I should have been basing my layouts on grid or flex techniques.
A lot of my work on Responsive Website Design was made following examples that I had found on the W3C Schools website and elsewhere on the Internet.
Selecting Items
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 Selector 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
Children 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.