Docsity

Cascading Style Sheets (CSS): Syntax, Properties & Styling Techniques – Complete Notes, Slides of Information Technology

Partial preview of the text

Download Cascading Style Sheets (CSS): Syntax, Properties & Styling Techniques – Complete Notes and more Slides Information Technology in PDF only on Docsity!

| PEOPLE : STRATEGISTS 2. What is CSS CSS stands for “Cascading Style Sheets” Cascading: refers to the procedure that determines which style will apply to a certain ction, if you have more than one style rule. Style: how you want a certain part of your page to look, You can set things like color, margins, font, ete for things like tables, paragraphs, and headings. Sheets: the “sheets” are like templates, or a set of rules, for determining how the webpage will look, CSS is a stylesheet language used to describe the presentation of a document written in HTML or XML. i PEOPLE STRATEGISTS Css Advantages A web application will contains hundreds of web pages, which are created using HTML. Formatting these HTML pages will be a laborious process, as formatting elements need to be applied to each and every page. CSS saves lots of work as we can change the appearance and layout of all the web pages PEOPLE ‘a by editing just one single CSS file. CSS Syntax Rules Rule have two parts - Selector and declaration, Selector: The HTML clement you want to add style to.

cte Declaration: ‘The statement of style for that element. Made up of property and value. Rules Selector ——. p {font-family:Arial;} A \ Property Value Lo Declaration _\ 9. CSS Selectors CSS selectors allow you to select and manipulate HTML elements based on their id, class, type, attribute, and more. Examples - Declaring a CSS Rule for a Class Attribute the HTML Brochure the CSS _pdf (background: url(images/pdf.gif) no-repeat left 50%;) use a period when writing a rule fora class Declaring a CSS Rule for an Id Attribute the HTML

Main Content
the CSS wrapper (width: 750px; margin: 0 auto;) use apound sign when writing a rule fora id CSS Selectors (Cont.) Declaring a CSS Rule for a Elements Attribute It will style all the content of that element which you are selecting, Example- The HTML.

Welcome to the Snapdeal Academy

Powered by — PeopleStrategists

The CSS p ftext-align: center; color: blue;} @ ‘PEOPLE GF STRATEGISTS Inserting a StyleSheet You can do in three different ways- 1. Extenmal Style Sheet Styles are specified in an external CSS file. you can change the looks of entire website by using single external style sheet. Egi 2. Internal Style Sheet To Appy specific styles to a single HTML. file inside the head section of an HTML page. Egz 3. Inline Styles Styles are specified inside an HTML. tag/clement. Egs

Demo of Inline Style

Prone WP STRATEGISTS Inserting a StyleSheet Multiple Style Sheets — It can be referenced inside an HTML, document. The questions is, what styles will be applicable when there is more than one style specified? All styles cascade into a new virtual style sheet by applying the following rules, where the higher number has the greater priority: Browser default. External Stylesheet. Internal Stylesheet (styles defined in head section). Inline Style (styles defined in an HTML element). Ref. Note Section- 9. Pwupe Formatting with CSS Properties CSS Background Image You can use an image as the background for an clement using background-image property. Example- body{ background-image:url(‘java.png’); i By default, the image is repeated, both horizontally and vertically, so as to cover the entire bedy (or the element on which it is applied). PEOPLE ? Formatting with CSS Properties SS dC The background-color property is used to specify the background color of an element, Example- body { background-color:darkblue; } Similarly, we can specify the background for any element (wherever applicable), pi background-color:orange; 9 } peor MP sTRATECSTS. Formatting with CSS Properties CSS Background Shorthand You can also specify all the properties in a single property. This property is known as shorthand property. For specifying shorthand property, you just need to use background. Example- body { background:cyan url(‘snapdeal.jpg') no-repeat right top; } 9. Formatting with CSS Properties Text Formatting ‘The following properties can be used for formatting text : 1. Text Color 2. Text Alignment 3. Text Decoration 4. Text Transformation 5. Text Indentation 9. Formatting with CSS Properties Text Decoration ‘You can use text-decoration property to set or remove decorations from text. Example- p {text-decoration:overline; } p itext-decoration:line-through;} p {text-decoration:underline;} Text Transformation You can use text-transform property to specify uppercase and lowercase letters of any text. Example- hi {text-transform:uppercase;} h2 {text-transform:lowercase;} peor WPstRaTecsrs. p {text-transform:capitalize;} Formatting with CSS Properties CSS Font CSS font properties are used to define the font family, size, style and boldness of the text. In CSS, there are two types of font family names: generic family - a group of font families with a similar look (like "Serif" or "Monospace"). font family - a specific font family (like "Times New Roman" or "Arial"). Comments in CSS /* comment */ - This is comment used in CSS. 9 ‘PEOPLE STRATEGISTS