Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS3220 Web and Internet Programming Page Layout with CSS

Similar presentations


Presentation on theme: "CS3220 Web and Internet Programming Page Layout with CSS"— Presentation transcript:

1 CS3220 Web and Internet Programming Page Layout with CSS
Chengyu Sun California State University, Los Angeles

2 Regular HTML Page Layout
The elements “flows” from left to right and top to bottom

3 Some Page Layouts We May Want

4 Using CSS Over Table for Layouts?
Separation of structure and presentation Better readability Easier to change and maintain More flexible and powerful Accessibility support Better performance

5 Example Header Menu Content Footer

6 The float Property An element is taken out of the normal flow and placed along the left or right side of its container The content of the other elements will wrap around the floated element

7 A float Example float: left;

8 The clear Property Whether an element can be next to floating elements that precede it or must be moved down below them left: no floating elements on the left right: no floating elements on the right both: no floating elements on either side

9 A clear Example clear: left;

10 The Positional Properties …
position – how an element is positioned static: normal position absolute: relative to the containing block fixed: relative to the browser window relative: relative to the normal position

11 … The Positional Properties
top, bottom, left, right – the positions of the top, bottom, left, and right side of the element z-index An element with higher z-index is displayed in front of elements with lower z-index Only works on positioned elements

12 CSS Layout Modes Block layout Inline layout Table layout
float; multiple columns Inline layout Table layout Positioned layout Flexible box (i.e. flexbox) layout Grid layout (experimental)

13 Multiple Columns Example
Mostly designed for displaying text Properties column-count column-width (suggested optimal width) column-gap column-rule

14 Flexbox Example display: flex; flex-direction flex-wrap align-items
align-content and justify-content

15 About Responsive Web Design (RWD) …
Motivation It’s important that a website looks good on mobile devices It’s undesirable to create separate designs for different devices Responsive Web Design – design website that automatically adapts to different viewing environments

16 … About Responsive Web Design (RWD)
A RWD example: The Boston Globe What’s required: CSS, JavaScript, layout patterns (e.g. some grid system) Libraries Bootstrap Material Design Lite (MDL) And many more


Download ppt "CS3220 Web and Internet Programming Page Layout with CSS"

Similar presentations


Ads by Google