Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline.

Similar presentations


Presentation on theme: "CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline."— Presentation transcript:

1 CSS Layout Cascading Style Sheets

2 Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline sections with tag  Block elements vs. inline elements

3 CSS Review

4 CSS – Rules Review  CSS Rule Syntax has 3 parts:  Selector  Property  Value Selector PropertyValue Rule

5 What are the 4 types of selectors?  Any HTML tag (p, table, h1, etc.) – the rule applies to ALL tags of that type on the page  A #idName given to a tag – the rule only applies to the ONE tag on the page with that ID  A.className given to any tags on the page  A pseudo class such as:  a:hover{color:red;} /* hyperlink hover color */

6 CSS – tag What does it do for us? My title

7 Browser What will we see in the browser? How it works: Review mystyles.css #foo{ color:red; }.bar { color:blue; } h1.bar { bgcolor:yellow; } Hello World My header HTML File Hello World My header …

8 What we’ve done previously: Tables for layout Navigation links Content This required,, tags with lots of mental mapping and CSS rules No More! We’ll move to using blocks called divs requiring much less complexity

9 Where we’re going div block Steps: 1.Set width and height of each block 2.Set a property for side by side 3.Fill each with what you want Let's look at Amazon.com as an example

10 tag  Defines a division/block in an HTML page.  Most often used together with CSS to layout a web page " What's the fox say?

11 example  Say we are creating a web site for courses  We want a new section for each subject  Use a section for English, one for Math,...

12 Demo:  Follow along with me:  Create a new HTML page called layout.html  Create a new CSS page called layoutstyles.css  Add to the web page:  In your CSS file, give the div a background color  Keep an eye on its default behavior  Later we’ll adjust width and height

13 In class Exercise for  Add two sections with different background colors to this page  Define the background colors in your new layoutstyles.css  Remember:  div tags can have id or class attributes set like any other tag  When you have that working, show me  Then add more content inside the div, and set properties for border, background-image, etc.

14 tag  Defines an inline element used purely as a range for applying styles  Provides a way to add a “container” to a part of a text or a part of a document  You can use this container to add CSS styles to the content

15 example

16 Exercise for  Open layout.html  Add a section to text within a section  Define CSS styles for this section

17 Block vs. Inline Block Elements  Have line break before and after  Contain inline elements and other block elements  Examples:   ~ ,  ,, Inline Elements  Have no line break before and after  Contain text and other inline elements  Examples: 

18 Block vs. Inline  Block and inline elements flow through the HTML page differently  They therefore create different layouts  Different CSS styles need to be used to achieve desired layout  Block level elements normally start (and end) with a new line, when displayed in a browser whereas inline elements are normally displayed without line breaks.

19 Document flow – block element

20 Document flow – inline element

21 Document flow – combined

22 Exercise  Create a page that combines,, and other tags you already know  Give borders to the elements to show how the layout works.


Download ppt "CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline."

Similar presentations


Ads by Google