h1This is a headingh1 When tags like font and color attributes were added to

H1this is a headingh1 when tags like font and color

This preview shows page 16 - 19 out of 48 pages.

<h1>This is a heading</h1> When tags like <font> and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large web sites where fonts and color information had to be added to every single Web page, became a long, expensive and unduly painful process. To solve this problem, the World Wide Web Consortium (W3C) - responsible for standardizing HTML - created CSS in addition to HTML 4.0. With HTML 4.0, all formatting can be removed from the HTML document and stored in a separate CSS file. All browsers support CSS today. Styles save a lot of work Styles sheets define HOW HTML elements are to be displayed. Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single CSS document! Multiple styles will cascade into one Style sheets allow style information to be specified in many ways. Styles can be specified: inside an HTML element inside the head section of an HTML page in an external CSS file Tip: Even multiple external style sheets can be referenced inside a single HTML document. Dept. of CSE, SKIT, Bangalore560090 P a g e | 12
Image of page 16
WEB TECHNOLOGY LABORATORY WITH MINI PROJECT ( 15CSL77 ) 2018-19 Cascading order - What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: 1. Browser default 2. External style sheet 3. Internal style sheet (in the head section) 4. Inline style (inside an HTML element) So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the <head> tag, or in an external style sheet, or in a browser (a default value). If the link to the external style sheet is placed after the internal style sheet in HTML <head>, the external style sheet will override the internal style sheet! Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property:value} The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces: body {color:black} Note: If the value is multiple words, put quotes around the value: p {font-family:"sans serif"} Note: If you want to specify more than one property, you must separate each property with a semicolon. The example below shows how to define a center aligned paragraph, with a red text color: p {text-align:center;color:red} To make the style definitions more readable, you can describe one property on each line, like this: P { text-align:center; color:black; font-family:arial } Grouping Dept. of CSE, SKIT, Bangalore560090 P a g e | 13 WEB TECHNOLOGY LABORATORY WITH MINI PROJECT ( 15CSL77 ) 2018-19
Image of page 17
You can group selectors. Separate each selector with a comma. In the example below we have grouped all the header elements. All header elements will be displayed in green
Image of page 18
Image of page 19

You've reached the end of your free preview.

Want to read all 48 pages?

  • Summer '20

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture