CSS Tutorial
Cascading Style Sheets or CSS, as it is informally known, is the premier developer’s tool for designing high-end websites. CSS language works with HTML to define the contents of a website with ease and flexibility in a straightforward process. Adjusting layouts and style sheets are manipulated with CSS. CSS saves programmer / designer’s time and energy in adjusting changes to the development of a website by placing the code directly into the HTML document head, and/or in a separate sheet for simple website alteration.
CSS has the additional benefit of reducing the file size of HTML documents, ridding the overall website of presentation attributes and image spacing in order to provide faster site navigation. CSS provides the programmer with secure style sheets that can be linked to a single document, ensuring correct presentation on different media including browsers, handheld devices, projectors and printers.
Tutorials and training related to CSS programming language are provided with full information on CSS Syntax, CSS Background, Working with Text and Fonts, creating Elements and Element Displays, Pseudo Classes, Media Styles, Borders, Margin, Padding, Dimensions and Colors. Sample code is supplied for the experienced or beginner developer to learn everything there is to know to create and design a dynamic, successful and professional-looking website.
Getting Started with CSS In this tutorial you will learn about Cascading Style Sheets (CSS), Introduction to CSS, What you should already know? History, What is CSS? CSS saves a lot of work and time, CSS reduces the file size of HTML documents and CSS can be designed for different media What you should already know? The tutorial assumes that you have basic understanding of the following topics: HTML/XHTML History In the old days we had only HTML, which was good, with HTML you can make good web designs, you can adjust the layouts using tables, and the layout problems…
CSS Syntax In this tutorial you will learn about Cascading Style Sheets (CSS) Syntax, Rule set, Combining selectors, The class selector, The id selector and Comments Rule set A rule or rule set tells the browser how to render an element, the rule set consists of the following: The selector: represents the HTML element to be affected by the rule. . The declaration block: represents the effect to be applied to the element(s), and it contains one or more property value pairs. Example: p {text-align: right; color: red} The selector here is the HTML element < p >, all what…
CSS External and Internal style Sheets In this tutorial you will learn about Cascading Style Sheets (CSS), Applying CSS, External style sheets, Internal styles, Inline styles and Multiple style sheets There are different types for specifying styles to be used with HTML documents, they can be specified in an external CSS file, inside the < head > element of the HTML document, or/and inline to be specific to a single HTML element, also there is the browser default style. These styles will be cascaded in a single HTML documents at the following priority: Browser default. . External CSS file. ….
CSS Background In this tutorial you will learn about Cascading Style Sheets (CSS), Background, Background Color, Background image, Repeating background image, Background position and Background attachment. Background color To set the background color of an element, use the “background-color” property. Example: body { background-color: #FF0000; } This sets the background color of the document to red. Background image To set an image as a background, use the “background-image” property. Example: body { background-image: url(bg_image.jpg); } Repeating background image To repeat a background image, use the “background-repeat” property. The value of this property defines how the repeat will occur, the…
CSS Text In this tutorial you will learn about Cascading Style Sheets (CSS), Text, Text color, Text background color, Text direction, Text align, Text indent, Text transform, Text decoration, Letter spacing and Word spacing. Text color To set the text color, use the “color” property. Example: p { color: #FF0000; } h1 { color: red; } This sets the HTML element < p > and the HTML element < h1 > to red. Text background color To set the background color of an element, use the property “background-color”, this property was explained in CSS background lesson. Text direction To set…
CSS Fonts In this tutorial you will learn about Cascading Style Sheets (CSS), Fonts, Font family,Font size, Font weight, Font style and Font variant. Font family To set the font for a specific text, use the property “font-family”, the value can be more than one family separated with a comma, the browser will display the text using the first font, if it’s not supported by the operating system, it will use the next font, if no font is supported, it will use the default font. Example: body { font: Arial, Helvetica, sans-serif; } This sets the HTML document font to…
CSS Borders In this tutorial you will learn about Cascading Style Sheets (CSS) Borders, Border width, Border style, Border color and Using the shortcut Borders in CSS are not just the table borders as in HTML, with CSS any HTML element can have borders, CSS adds many effects to be applied to these borders. Border width To set the width of a border, use the property “border-width”, the value of this property can be one of the following values: thin, medium, thick, or an absolute value as the table “border” attribute in HTML. Example: table { border-width: 2px; } This…
CSS Margin In this tutorial you will learn about Cascading Style Sheets (CSS) Margin and Using the shortcut. The margin is the space around the element from the four sides, the margin attributes enables you to increase or decrease this space; the space can be a negative value, which may make elements overlap. Using margins is very easy and straight forward, to declare the margin you can use the following properties: margin-top, margin-right, margin-bottom, and/or margin-left. The values of these properties can be an absolute length, a percentage. Example: .margins { margin-top: 5px; margin-right:10px; margin-bottom: 5px; margin-left: 12px; } This…
CSS Padding In this tutorial you will learn about Cascading Style Sheets (CSS) Padding, The padding is the space between the element border and the element content from the four sides, the padding attributes enables you to increase or decrease this space; unlike spacing padding space values can’t be negative. To declare the padding you can use the following properties: padding-top, padding-right, padding-bottom, and/or padding-left. The values of these properties can be an absolute length, a percentage. Example: table { padding-top: 5px; padding -right:3px; padding -bottom: 5px; padding -left: 2px; } This sets the top padding of the < table…
CSS List In this tutorial you will learn about Cascading Style Sheets (CSS) List, List style type, List style position, List style image and Using the shortcut. List style type To set the list style marker type, use the property “list-style-type”, this property can have on of the following values: none, circle, disc, square, decimal, decimal-leading-zero, lower-alpha, upper-alpha, lower-greek, lower-latin, upper-latin, lower-roman, upper-roman, armenian, cjk-ideographic, georgian, hebrew, hiragana, hiragana-iroha, katakana, or katakana-iroha. Example: < ul style="list-style-type: disc;" >Fruits: < li >Apples< /li > < li >Bananas< /li > < /ul > This will be presented as follows: Fruits: • Apples…
CSS Dimensions In this tutorial you will learn about Cascading Style Sheets (CSS) – Dimensions, Line height, Width and Height. The dimension properties enable you to increase or decrease the height and width of HTML elements. Line height To set the distance between the lines of an element, use the property “line-height”, the value of this attribute can be an absolute value or a percentage. Example: p { line-height: 0.3cm; } This sets the distance between lines to 0.3 cm. Width: To control the width of an element, you can use three properties, they are: • “width”: sets the element…
CSS Elements Display In this tutorial you will learn about Cascading Style Sheets (CSS) – Elements Display, Float, Position, Visibility, Cursor, Vertical align and z-index. The display properties enable you to set the way to display elements and the position of the element relative to another element or to the whole document. Float To set the appearance of an element or an image relative to another element, use the property “float”, this property can have on of the following values: left, right, or none. Example: img { float: left; } This sets the image position to be at the left…
CSS Pseudo Classes In this tutorial you will learn about Cascading Style Sheets (CSS) – Pseudo Classes, Link, First letter and First line CSS has pre-defined pseudo classes. pseudo class has special syntax, the rule starts with the selector, then the pseudo class, and finally the declaration, the selector and the pseudo class are separated with a colon “:”. CSS defines the following pseudo classes: link, hover, active visited, first-line, and first-letter. Link To define link properties, you can use four pseudo classes, they are: • link: sets the style of the unvisited link. • hover: sets the style of…
CSS Tutorials : Lesson 14 – Media Types In this tutorial you will learn about Cascading Style Sheets (CSS) – Media Styles, Internal different media CSS and External CSS files. CSS adds support for different media types, you can create many styles, and each style defines how the document will be styled when its media type is used. There are two ways to use a different CSS for different media types in the same document, you can place the style internally in the HTML document, or you can create as many CSS files and link them to the HTML document….
CSS Units, Colors and References In this tutorial you will learn about Cascading Style Sheets (CSS), Units and Colors, Percentage, Values, Colors, References – Font and Text, Color and Background, Layout, Classification, Positioning and Pseudo-classes. Units and Colors Percentage Percentage values have to be followed by “%”. Values The absolute values represent a measurement, there are many measurements in CSS, so the measurement unit has to be stated. CSS measurement units are: • cm: centimeter. • em: font size. • ex: half of the font size. • in: inch. • mm: millimeter. • pc: pica. • pt: point. • px:…