A general summary of CSS and how it plays a part in website development.
What is the purpose of CSS
CSS otherwise known as Cascading Style Sheets, allow developers(that’s you) to create amazing looking web pages. Now that’s the general definition, but what exactly does that mean? Well to put it in lamens terms, it allows for the developer to stylize the website, from color and size of heading and links to turning a single column of text into a layout with a main section and a side section of relating information.
However it is important to remember that CSS is a rule dependent language. You define those rules by specifying groups of styles that can be applied to particular elements or groups of elements that will be displayed on your webpage. Kind of like a guidebook to follow.
What are the three ways to add CSS into our projects?
The three main ways to add CSS styling to your developing website are:
- External CSS
- Internal CSS
- Inline CSS
Now knowing these ways is all well and good but how do we impliment CSS styling and by that I mean how does it look when we get under the hood and start coding it into our website?
A simple example is as such, for **setting a rule that gives all paragraphs<p> the element of red text is as follows:
p { color: red }
Very simplistic but what it means is all paragraphs that begin with the p element the CSS rule will set their color to red.
Now does this mean that all subsequent lines of code will follow this idea? No, this particular rule only applies to the condition of P for paragraphs. However, you can add more conditional rules following the previous condition. If you wanted to then set headers to be a certain size or style you can and one rule will not affect the other.