CSS Introduction
What is CSS?
CSS stands for Cascading Style Sheets. It defines how to display HTML elements.
The following HTML code includes CSS for styling.
<!DOCTYPE HTML>
<html>
<head>
<style>
a { <!-- w w w . j a va 2s .co m-->
background-color:grey;
color:white
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the website</a>
</body>
</html>
The code above set the background color and foreground color.
Styles are normally saved in external .css
files.
The code above generates the following result.
HTML CSS Tutorial HTML CSS Basic
HTML Introduction
HTML Documents
HTML Element
HTML Attributes
HTML Core Attributes
HTML Comments
HTML Headings
HTML Paragraphs
HTML Rules (Lines)
HTML Line Breaks
CSS Color
CSS Lengths
CSS Comments
CSS selector
Grouping/nesting Selectors
Add CSS to HTML
Compare em measurement and pixel measuremen...
Select class along with tag name in HTML an...
Select Next Sibling with Next Sibling Selec...
Select with Descendant Selectors in HTML an...
Set color to purple in HTML and CSS
Set color with rgb function in HTML and CSS
Set text color for body element in HTML and...
Show the difference between block and inlin...
HTML Introduction
HTML Documents
HTML Element
HTML Attributes
HTML Core Attributes
HTML Comments
HTML Headings
HTML Paragraphs
HTML Rules (Lines)
HTML Line Breaks
CSS Introduction
CSS SyntaxCSS Color
CSS Lengths
CSS Comments
CSS selector
Grouping/nesting Selectors
Add CSS to HTML
Compare em measurement and pixel measuremen...
Select class along with tag name in HTML an...
Select Next Sibling with Next Sibling Selec...
Select with Descendant Selectors in HTML an...
Set color to purple in HTML and CSS
Set color with rgb function in HTML and CSS
Set text color for body element in HTML and...
Show the difference between block and inlin...