Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to CSS CS 1150 Spring 2017.

Similar presentations


Presentation on theme: "Intro to CSS CS 1150 Spring 2017."— Presentation transcript:

1 Intro to CSS CS 1150 Spring 2017

2 How CSS Works CSS allows you to create rules that specify how the content of an element should appear CSS mostly involves learning the different properties you can use The key to understanding how CSS works is to imagine there is an invisible box around every HTML element

3 Block and Inline Elements

4 CSS Rules CSS works by associating rules with HTML elements
The rules govern how the content of specified elements should be displayed A CSS rule contains two parts: a selector and a declaration Example: p { font-family: Verdana; }

5 CSS Properties CSS properties affect how elements are displayed
CSS declarations sit inside curly brackets and each is made up of two parts: a property and a value, separated by a colon Example h1, h3 { font-family: Verdana; color: purple: }

6 Using External CSS The <link> element can be used in an HTML document to tell the browser where to find the CSS file used to style the page The <link> element is an empty element, meaning it does not need a closing tag The <link> element should always be inside the <head> section It should contain three attributes: href – this specifies the path to the CSS file type – this attribute specifies the type of document being linked to (the value should be text/css) rel – this specifies the relationship between the HTML page and the file it is linked to

7 Using Internal CSS CSS can also be included in a page by placing them inside a <style> element, which usually sits inside the <head> section of the page The <style> element should use the type attribute to indicate that the styles are specified in CSS (the value should be text/css) Example: <style type=“text/css”> body { font-family: Verdana; } </style>

8 The Element Selector The element selector selects elements based on the element name Example: p { text-align: center; color: red; }

9 The id Selector The id selector uses the id attribute of an HTML element to select a specific element Example: #paragraph1 { text-align: center; color: red; }

10 The class Selector The class selector selects elements with a specific class attribute Example .center { text-align: center; color: red; }


Download ppt "Intro to CSS CS 1150 Spring 2017."

Similar presentations


Ads by Google