Download presentation
Presentation is loading. Please wait.
Published bySharon Burns Modified over 9 years ago
1
Tutorial 4: Using CSS for Page Layout
2
2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View prebuilt CSS layout pages Insert floating divs and nest divs Duplicate pages Session 4.2 Draw AP divs Select, resize, and move AP divs Add content to AP divs Adjust AP div attributes Examine code for AP div tags Modify AP div stacking order Align and position AP divs Nest AP divs
3
Tutorial 4: Using CSS for Page Layout3 Understanding Layout Techniques Understanding how Web design has evolved will give you a better understanding of current layout techniques Traditional layout techniques –Tables –Frames Current layout techniques –Div tags –Cascading Style Sheets (CSS) styles
4
Tutorial 4: Using CSS for Page Layout4 Traditional HTML Layout Techniques Tables (grid structure) –Provide flexibility in arranging content –Resulting HTML code is cumbersome –Still sometimes used to structure content Frames –Divide a Web page into multiple HTML documents –Each frame contains a single HTML document with its own content and potentially its own scroll bars –Use a frameset to hold Web page together –Outdated; rarely used
5
Tutorial 4: Using CSS for Page Layout5 Current CSS Layout Techniques Div tags –Placed around text, images, and page elements to structure and position the chunks of content –Create transparent, block-level container in a Web page to hold content –Almost any other tag can be placed in in a div tag CSS styles –Can be added to a div tag –Adjust page layout by creating styles to position divs Challenges: different browsers, monitor sizes, or screen resolutions
6
Tutorial 4: Using CSS for Page Layout6 Positioning Div Tags in Web Pages Absolute positioning (AP) –Specifies exact pixel in browser window where upper-left corner of div tag will be placed –Difficult to use effectively for page layout because of differences in screen resolution Floating positioning –Create flexible designs that vary in size and position in response to monitor size and screen resolution –Used more frequently for page layout
7
Tutorial 4: Using CSS for Page Layout7 Comparing Types of Floating Layouts Fixed width Sets specific size for pages, regardless of user’s screen resolution Liquid (or fluid) Adjusts to fit user’s browser width Maximizes use of browser real estate Limits control over design elements (e.g., symmetry, white space) ElasticFixed-width designs that use ems instead of pixels as the unit for div and text styles Enables text and page layout to change size when user’s browser displays font size changes More accessible for users with assistive devices or impaired vision
8
Tutorial 4: Using CSS for Page Layout8 Exploring CSS Layout Code Dreamweaver adds comments (i.e., notes) to code of HTML pages that are not read or displayed by browsers –Help designers understand what the code is used for and how it works –Help with recall if pages need editing in the future –Help distinguish one closing div tag from another and ensure that tags are in the right order in the page –Parent-child tag relationship Two types of comments –Single line span only one line: –Multiline span more than one line: /* comment */
9
Tutorial 4: Using CSS for Page Layout9 Exploring CSS Layout Code Viewing the prebuilt CSS elastic layout page New Document dialog box
10
Tutorial 4: Using CSS for Page Layout10 Exploring CSS Layout Code Viewing the prebuilt CSS elastic layout page Pre-built CSS page with an elastic layout
11
Tutorial 4: Using CSS for Page Layout11 Exploring CSS Layout Code Viewing prebuilt CSS fluid layout pages Figure 4-5 Prebuilt CSS page with a fluid layout
12
Tutorial 4: Using CSS for Page Layout12 Exploring CSS Layout Code Viewing prebuilt CSS fixed-width layout pages Pre-built CSS page with a fixed-width layout
13
Tutorial 4: Using CSS for Page Layout13 Exploring CSS Layout Code Viewing prebuilt CSS fixed-width layout pages Selected div tag in Code view
14
Tutorial 4: Using CSS for Page Layout14 Planning the CSS Layout Determine which CSS elements the pages require Use ID type styles –Each page will have only one heading, a content area, and a footer area
15
Tutorial 4: Using CSS for Page Layout15 Planning the CSS Layout Layout of the NextBest Fest site
16
Tutorial 4: Using CSS for Page Layout16 Determining Div Tags Display Order Div tags appear in the page in the order in which they appear in the code –Place pointer in desired location in Document window before inserting new div tag Place container or wrapper div tags around other divs and elements in the page
17
Tutorial 4: Using CSS for Page Layout17 Creating Common CSS Style Attributes for Layout Create CSS styles and apply them to a div that you want to have specific attributes or characteristics Most useful attributes for layout are in the Box category –Width –Height –Float Develop a flexible naming system – Clear – Padding – Margin
18
Tutorial 4: Using CSS for Page Layout18 Inserting Div Tags Choose where, in the code, the tag is placed –At insertion point –Before tag –After start of tag –Before end of tag –After tag Can apply existing class or ID style to the div Can create a new CSS rule
19
Tutorial 4: Using CSS for Page Layout19 Inserting Div Tags Insert Div Tag dialog box
20
Tutorial 4: Using CSS for Page Layout20 Inserting Div Tags Div tag in the home page
21
Tutorial 4: Using CSS for Page Layout21 Adding Comments to the Code in HTML Pages Recommended for: –Creating complex code that might need to be edited later –Working in a team environment
22
Tutorial 4: Using CSS for Page Layout22 Adding Comments to the Code in HTML Pages Comment added to the closing content div tag
23
Tutorial 4: Using CSS for Page Layout23 Duplicating Pages Saves time Assures that basic page structure is the same for all pages in the site
24
Tutorial 4: Using CSS for Page Layout24 Editing the Style Sheet from the CSS Styles Panel Any change made in one place will affect all pages in the site
25
Tutorial 4: Using CSS for Page Layout25 Using Absolutely Positioned Div Tags Positioned with accuracy and reliability Remain in place relative to page margins regardless of size of browser window Can be stacked on top of one another so that content overlaps Can be animated, made visible or invisible, and have stacking order changed Can be customized using CSS styles
26
Tutorial 4: Using CSS for Page Layout26 Drawing AP Divs AP div drawn in the home page
27
Tutorial 4: Using CSS for Page Layout27 Selecting, Resizing, and Moving an AP Div Div must be selected before it can be repositioned or resized Use resize handles to change dimensions of AP div to fit the content Reordering or moving –X coordinate: left position of AP div –Y coordinate: top position of AP div –Z-index number: stacking order –Rulers and guides enable easy placement
28
Tutorial 4: Using CSS for Page Layout28 Selecting, Resizing, and Moving an AP Div AP div selected in the home page
29
Tutorial 4: Using CSS for Page Layout29 Selecting, Resizing, and Moving an AP Div Repositioned AP div
30
Tutorial 4: Using CSS for Page Layout30 Adding Content to an AP Div Uses same methods used to insert content directly into Web page Can move content from the page to an AP div by dragging it AP divs must be active to accept content Can contain almost any type of content: text, graphics, forms, multimedia
31
Tutorial 4: Using CSS for Page Layout31 Adding Content to an AP Div AP div with text content
32
Tutorial 4: Using CSS for Page Layout32 Adding Content to an AP Div AP div width updated in the Property inspector
33
Tutorial 4: Using CSS for Page Layout33 Adjusting AP Div Attributes Create CSS style with desired attribute values and attach that style to AP divs, or… Use Property Inspector, which includes these attributes: –CSS-P Element –L and T –W and H –Z-Index –Vis – Bg image – Bg color – Class – Overflow – Clip
34
Tutorial 4: Using CSS for Page Layout34 Examining the Code for AP Div Tags When an AP div is created, Dreamweaver places an ID style in the head of the page (not the style sheet) that defines: –Type of positioning –Left and top coordinates of AP div –Width and height –Overflow value –Z-index number Sometimes useful to create external styles to define AP div positioning
35
Tutorial 4: Using CSS for Page Layout35 Examining the Code for AP Div Tags AP div in Split view
36
Tutorial 4: Using CSS for Page Layout36 Examining the Code for AP Div Tags Code for the AP div’s ID style
37
Tutorial 4: Using CSS for Page Layout37 Modifying AP Divs Change stacking order of AP divs by changing z- index number Align AP divs to each other or to an invisible grid Nest one AP div inside another
38
Tutorial 4: Using CSS for Page Layout38 Adjusting Stacking Order AP Elements panel
39
Tutorial 4: Using CSS for Page Layout39 Adjusting Stacking Order AP div stacking order changed
40
Tutorial 4: Using CSS for Page Layout40 Aligning AP Divs Select an AP div, press and hold Shift key, then click other AP divs to align Last AP div selected remains stationary; other AP divs align to it AP divs top aligned
41
Tutorial 4: Using CSS for Page Layout41 Positioning Elements Using the Grid Show or hide grid (default is for grid to be hidden) Change size of grid squares for more precise alignment Use Grid Setting dialog box to change appearance of grid
42
Tutorial 4: Using CSS for Page Layout42 Positioning Elements Using the Grid Grid in the Document window
43
Tutorial 4: Using CSS for Page Layout43 Creating Nested AP Divs Used to group AP divs –Move together –Share attributes with parent Nesting refers to underlying code, not physical position
44
Tutorial 4: Using CSS for Page Layout44 Creating Nested AP Divs Nested available AP div repositioned
45
Tutorial 4: Using CSS for Page Layout45 Updating the Web Site on the Remote Server Upload every page of the site Include dependent files so that new graphics and CSS styles are uploaded Preview the site on the Web as final review of changes
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.