08 - CSS Introduction
08 - CSS Introduction
ENGINEERING
Engr. Faryal Baloch
Department of Software Engineering
MUET
Fair Use Notice
CSS CSS
CSS CSS
Headings
Body
Applying a single style sheet to multiple documents
Applying multiple style sheets to a single document
Why to Use CSS?...
❑ Further Advantages:
- Faster download times: Reduction of file size is about 50% less
than a Web page built with traditional Web design methods.
- Shorter development time: Easily tweak the design of a
thousand-page site with just a few edits of one CSS file
- Greater control over the typography in a Web page: CSS's ability
to control typography better
- Better control over the placement of elements in Web page
CSS Syntax…
❑ Style rule has 3 parts:
- Selector; is an HTML tag at which style will be applied; this could be any tag like <h1> or
<table> etc.
- Property; is a type of attribute of HTML tag; put simply, all the HTML attributes are converted
into CSS properties. They could be color or border etc.
- Value; are assigned to properties; for example, color property can have value either red or
#F1F1F1 etc.
p b { color: yellow }
/* This is a comment */
P { color: red;
/* This is another comment */
Font-family: veranda }
Types of CSS...
❑ Type defines the way we insert style sheet
- INLINE CSS: With an inline style, a unique style is applied to a single element.
- In order to use an inline style, add the style attribute to the relevant tag.
- The example below shows how to create a paragraph with a gray background and white text: