All about CSS (Cascading Style Sheets)
All about CSS (Cascading Style Sheets)
History
Hakon Wium Lie first proposed CSS in 1994. He was working with Tim Berners-Lee, the daddy of HTML at CERN. CSS2 came call at 1998 with better features like absolute, relative, fixed, positioning, z-index, the concept of media type, bidirectional text, and new font properties like shadows. the event of CSS3 started later that year, but it had been never completed.Using CSS, you can control
- color of the text - you can change text color, opacity and position.
- The style of fonts - change font family, font weight, inline space, line between space ect..
- The spacing between paragraphs - use margin to spacing between the two paragraphs
- how columns are sized and laid out - use width and height to changing column size.
- background images or colors - use images to set background body are particular div same process to set background-color
- layout designs - header, footer, sidebar and model
- Different type of display for different screen sizes as well as a variety of other effects customized code used (@media).
CSS is easy to learn and understand. But it provides powerful control over the presentation(web page) of an HTML document.
Mostly CSS is combined with the markup languages HTML or XHTML.
Three Types of CSS
CSS comes in three types:
- In a separate file (external)
- At the top of a web page document (internal)
- Right next to the text it decorates (inline)
External:
- style sheets are separate files full of CSS codes (with the file extension .css).
- When any web page includes an external stylesheet (css file), its look and feel will be controlled by this CSS file
- This type use to change a whole website at one modification.
Internal :
- Styles are placed at the top of each web page document (head tag) <head> <style></head>, before any of the content is listed.
- This is the next best thing to external, because they're easy to find, yet allow you to 'override' an external style sheet -- for that special page that wants to be a nonconformist.
Inline:
- Styles are placed right where you need them, next to the text or graphic you wish to decorate.
- You can insert inline styles anywhere in the middle of your HTML code (tags),
- But it is to use lot of time of spend to write a css code every tags.
Output:
Why use CSS
Three major benefits of CSS:
1) Attractive web page
Before CSS, tags like element alignments, border,font, color, background style and size had to be repeated on every web page.
2) Saves a lot of time
CSS style saved in external file so it can to change the whole website (linked page only) by changing just one file.
3) Provide more attributes
CSS provides more detailed attributes than plain HTML to define the good look and feel clear good view of the website.