Search This Blog

CSS Tutorial

 

css tutorial

CSS Tutorial

CSS stands for Cascading Style Sheets. It is the technology used to style web pages that are displayed on web browsers. All web developers should know how to write, structure, and troubleshoot CSS.

Our tutorial starts by covering CSS properties to style your HTML document and then moves to the more advanced concepts around CSS selectors. With this tutorial, you should be on your way to understanding and creating your own stylesheets.

Prerequisites

There are no prequisities for this CSS tutorial, however, it is strongly recommended that you review our HTML tutorial first so that you have a basic understanding of HTML tags.

You should be able to easily understand this tutorial and learn the basic concepts of how to style web documents using CSS.

Now, let's get started!

Start Tutorial

Or jump directly to a topic in CSS:

CSS Properties

Font Properties

fontSet the font-style, font-variant, font-weight, font-size, line-height, and font-family
font-familyPrioritized list of font family names to apply to an element
font-sizeSize of the font
font-styleStyle of the font (italic, oblique, normal)
font-variantVariant of the font (small-caps, normal)
font-weightWeight or boldness of the font
line-heightHeight used in the calculation of the line box height for an inline element.
Minimal height of the line box for a block level element

Text Properties

colorForeground color of the text content of an element
letter-spacingAmount of space between characters of text
text-alignAlign text within the parent block element
text-decorationText formatting of an element such as underline, overline, line-through and blink
text-indentAmount of indentation before the first line of an element's text
text-shadowShadow effects for the text of an element
text-transformCapitalize the text of an element such as uppercase, lowercase, capitalize
white-spaceHow to handle whitespace within an element
word-spacingAmount of space between words
word-wrapWhether line breaks within words are allowed

Background Properties

backgroundColor, image, repeat, position and attachment of a background
background-attachmentBackground image for an element is fixed within the viewport or scrolls along with its containing block
background-colorBackground color of an element
background-imageBackground image for an element
background-positionPosition of background-image for an element
background-repeatRepeat background image for an element

Positioning Properties

bottomBottom position for a positioned element
clearClear floated elements
floatFloat an element to either the left or right
leftLeft position for a positioned element
positionPosition of an element
rightRight position for a positioned element
topTop position for a positioned element

Box Model Properties

box-shadowShadow effects for an element
heightHeight of the content area of an element
marginMargin on all sides of an element
margin-bottomMargin on the bottom of an element
margin-leftMargin on the left side of an element
margin-rightMargin on the right side of an element
margin-topMargin on the top of an element
max-heightMaximum height of the content area of an element
max-widthMaximum width of the content area of an element
min-heightMinimum height of the content area of an element
min-widthMinimum width of the content area of an element
overflowBehavior when content overflows the content box
overflow-xBehavior when content overflows the content box horizontally (ie: left to right)
overflow-yBehavior when content overflows the content box vertically (ie: top to bottom)
paddingPadding space on all sides of an element
padding-bottomPadding space on the bottom of an element
padding-leftPadding space on the left side of an element
padding-rightPadding space on the right side of an element
padding-topPadding space on the top of an element
widthWidth of the content area of an element

List Style Properties

list-styleAppearance, position, and image for list item elements
list-style-imageImage to use as the list item marker
list-style-positionPosition of the list item marker in the principal block box
list-style-typeAppearance of a list item element

Outline Properties

outlineWidth, line style, and color of the outline of an element
outline-colorColor of the outline around an element
outline-styleLine style of the outline around an element
outline-widthWidth of the outline around an element

Table Properties

border-collapseRendering model to use for the table borders
border-spacingSpacing between the borders of adjacent cells in a table
caption-sidePosition of a table-caption
table-layoutAlgorithm to layout cells, rows, and columns in a table
vertical-alignVertical alignment of an inline element or table cell element

Border Properties

borderWidth, line style, and color of the border of a box
border-bottomWidth, line style, and color of the bottom border of a box
border-bottom-colorColor of the bottom border of a box
border-bottom-left-radiusRounded corners on the left side of the bottom border of a box
border-bottom-right-radiusRounded corners on the right side of the bottom border of a box
border-bottom-styleLine style of the bottom border of a box
border-bottom-widthWidth of the bottom border of a box
border-colorColor of the border of a box
border-leftWidth, line style, and color of the left border of a box
border-left-colorColor of the left border of a box
border-left-styleLine style of the left border of a box
border-left-widthWidth of the left border of a box
border-radiusRounded corners on the border of a box
border-rightWidth, line style, and color of the right border of a box
border-right-colorColor of the right border of a box
border-right-styleLine style of the right border of a box
border-right-widthWidth of the right border of a box
border-styleLine style of the border of a box
border-topWidth, line style, and color of the top border of a box
border-top-colorColor of the top border of a box
border-top-left-radiusRounded corners on the left side of the top border of a box
border-top-right-radiusRounded corners on the right side of the top border of a box
border-top-styleLine style of the top border of a box
border-top-widthWidth of the top border of a box
border-widthBorder width of a box

Page Break Properties

page-break-afterPage breaks after an element
page-break-beforePage breaks before an element
page-break-insidePage breaks inside an element

Other Properties

displayType of rendering box to use for an element
opacityTransparency of an element

CSS Selectors

:activeTarget element that is being activated
:afterAdd content after a selected element
:beforeAdd content before a selected element
:first-childTarget first child element of its parent
:first-letterTarget first letter of a block element
:first-lineTarget first line of a block element
:hoverTarget element when cursor hovers over it
:last-childTarget last child element of its parent
:linkTarget links that have not been visited
:nth-childTarget nth child element of its parent
:nth-last-childTarget nth last child element of its parent
:only-childTarget only child element of its parent
:visitedTarget visited links
child (> combinator)Target direct child element of an element type
descendantTarget descendant element of an element type

Validators

CSS ValidatorValidate your CSS
HTML ValidatorValidate your HTML

No comments:

Post a Comment

CSS: font-variant property

  CSS:   font-variant property This CSS tutorial explains how to use the CSS property called   font-variant   with syntax and examples. Desc...