Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with.

Similar presentations


Presentation on theme: "Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with."— Presentation transcript:

1 Cascading Style Sheets CSS

2 div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with id or class Ex: can be used to group an with to show they are conceptually related Ex: can be used to group a section of content for context, structure or layout purposes.

3 span … Generic inline element Used to add meaning to content Give it a descriptive name with id or class Ex: Andy: 123-4567 Joe: 101-0101

4 Element identifiers - id Id identifier Used to identify a piece of data Unique element in the document Value of id must be used only once in a document (masthead & navigation here) (main content elements here) (list of links here) (news sidebar items here) (copyright info, etc)

5 Element identifiers - class class identifier Used to group similar elements Multiple elements may share a class name The Complete Manual of Typography, James Felici A combination of type history and examples of good and bad type. A combination of type history and examples of good and bad type.

6 CSS Positioning Normal Flow Top -> bottom | left -> right Arranged in the order they appear in the code make room for one another (objects affect the layout of the objects around them)

7 CSS Positioning float Values: left | right | none Ex: img { float: right; } positions an element to left or right allowing surrounding content to wrap around Floating Inline Elements Must provide width & height values Floating Block Elements Must provide width & height values Elements do not float higher than their reference in the source code

8 CSS Positioning Clearing floated elements clear Values: left | right | both | none Prevents elements from appearing next to a floated element

9 CSS Positioning position Values: static | relative | absolute | fixed offset Values: top | right | bottom | left Defines the distance the element should be moved Ex: em { position: relative; top: 30px; left: 60px; }

10 CSS Positioning position Values: static | relative | absolute | fixed Static: elements positioned as in normal flow Relative: moves an element relative to its original position space it would have occupied is preserved (empty space left behind) Overlap happens

11 CSS Positioning

12 position Absolute: removes element from normal document flow Absolute positioned elements have NO influence on layout of surrounding elements Positioned relative to its containing element Space it would have occupied is closed Overlap happens

13 CSS Positioning

14 position Fixed: element fixed in one position (does not scroll) Similar to absolute positioning Offset values are relative to the browser window (viewport)

15 CSS Positioning Stacking Order Elements stack in the order they appear in the source doc. Z-index (change the stacking order) Higher the z-index - higher the element will appear in the stack

16 CSS Page Layout Liquid (fluid): Page reflow in browser window Advantage: Design for any monitor resolution Disadvantage: may end up with long lines of text (uncomfortable to read) www.W3.org Fixed: page stays a specific pixel width Advantage: predictable layout, more control Disadvantage: right edge may not be seen on smaller browsers Text elements may be re-sized affecting layout www.oreilly.com Elastic: layout expands and contracts with size of text (em based) Advantage: provides consistent layout while allowing flexibility in text size Disadvantage: images can’t be dynamically resized www.csszengarden.com/?cssfile=/063/063.css Responsive: http://www.burton.com/on/demandware.store/Sites-Burton_US-Site/default http://www.burton.com/on/demandware.store/Sites-Burton_US-Site/default

17 CSS - Layout

18

19

20 Let’s see how this works…


Download ppt "Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with."

Similar presentations


Ads by Google