HTML Basic
HTML HOMEHTML Introduction
HTML Get Started
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Formatting
HTML Fonts
HTML Styles
HTML Links
HTML Images
HTML Tables
HTML Lists
HTML Forms
HTML Frames
HTML Iframes
HTML Colors
HTML Colornames
HTML Colorvalues
HTML Quick List
HTML Advanced
HTML LayoutHTML Doctypes
HTML CSS
HTML Head
HTML Meta
HTML Scripts
HTML Entities
HTML URLs
HTML URL Encode
HTML Webserver
HTML Summary
HTML Media
HTML MediaHTML Audio
HTML Object
HTML Video
HTML YouTube
HTML Media Tags
HTML XHTML
XHTML IntroXHTML Syntax
XHTML Doctype
HTML Examples
HTML ExamplesHTML Quiz
HTML Certificate
HTML References
HTML Tag ListHTML Attributes
HTML Events
HTML Colornames
HTML Colorpicker
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTML Status Codes
HTML5
HTML5 TutorialHTML5 Reference
HTML Styles
| « Previous | Next Chapter » |
In HTML 4.0, all formatting can be removed from the HTML document, and stored in a style sheet.
Try-It-Yourself Examples |
How to add style information into the <head> section.
Link that is not underlined
How to make a link that is not underlined, with the style attribute.
Link to an external style sheet
How to use the <link> tag to link to an external style sheet.
How to Use Styles
When a browser reads a style sheet, it will format the document according to it.There are three ways of inserting a style sheet:
- External style sheet
- Internal style sheet
- Inline styles
External Style Sheet
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the <head> section:| <head> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head> |
Internal Style Sheet
An internal style sheet can be used if one single document has a unique style. Internal styles are defined in the <head> section of an HTML page, by using the <style> tag, like this:| <head> <style type="text/css"> body {background-color:yellow;} p {color:blue;} </style> </head> |
Inline Styles
An inline style can be used if a unique style is to be applied to one single occurrence of an element.To use inline styles, use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example below shows how to change the text color and the left margin of a paragraph:
| <p style="color:blue;margin-left:20px;">This is a paragraph.</p> |
HTML Style Tags
| Tag | Description |
|---|---|
| <style> | Defines style information for a document |
| <link /> | Defines the relationship between a document and an external resource |
| « Previous | Next Chapter » |
Your browser does not support inline frames or is currently configured not to display inline frames.
Create Your Own Website Like a Pro
Start Creating a stunning, Flash website. It's easy and free!Wix.com offers you a simple, powerful, drag & drop editing platform to create stunning Flash websites, layouts, and more.
With added e-commerce features such as search engine visibility and professional tools, Wix is the ultimate solution for creating a spectacular site.
W3Schools' Online CertificationThe perfect solution for professionals who need to balance work, family, and career building.More than 6000 certificates already issued! Get Your Certificate » |
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Top 10 Web Hosting |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $7.95/mo SEO Hosting |
| WEB BUILDING |
|---|
| Download XML Editor |
| FREE Website BUILDER |
| Free Website Templates Free WordPress Themes |
| W3SCHOOLS EXAMS |
|---|
| Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
| New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
| Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|