Web Page Layout With CSS CSS Level 2 vs. Nested Tables Mike Wallick – 11/3/04.

Slides:



Advertisements
Similar presentations
Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Advertisements

Chapter 3 – Web Design Tables & Page Layout
J ENWARE Chapters 14 & 15 Learning Web Design, Fourth Edition by Jennifer Niederst Robbins Copyright © 2012.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Cascading Style Sheets
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Web Standards XHTML and CSS. Today’s Show ► Discuss web standards ► XHTML ► Layout Without Tables ► CSS ► Why Web Standards?
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Client-Side Internet and Web Programming
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
Navigation Bars Level 2 Extended Certificate Unit B12 Doing Business Online.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Today’s objectives Site performance Padding, Margins, Borders
Murach’s ASP.NET 3.5/C#, C5© 2008, Mike Murach & Associates, Inc.Slide 1.
XHTML1 Tables and Lists. XHTML2 Objectives In this chapter, you will: Create basic tables Structure tables Format tables Create lists.
Using HTML Tables.
4.01 Cascading Style Sheets
TUTORIAL 8: Enhancing a Web Site with Advanced CSS
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
IMAGES Controlling size of images in CSS Aligning images in CSS Adding background images.
Bayu Priyambadha, S.Kom. for long documents, you can even have links to other locations in that same document  … where ident is a variable for identifying.
CSS Box Model. What is the CSS Box Model? The “Box Model” is a tool we use to lay out our web pages in a number of individual "boxes" or "containers".
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
The Characteristics of CSS
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
Basic Responsive Design Techniques. Let’s take a look at this basic layout. It has a header and two columns of text, in a box that is centered on the.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
 Word doc for you to download › Link at the beginning of class › 10 Questions › Answers to be added inline  Post to Sakai when completed › No resubmits.
CSS. HTML: Looking Back HTML dictates order, structure, and function Does very little to specify layout or visual rendering.
Essentials of HTML Class 4 Instructor: Jeanne Hart
WEB DESIGN AND PROGRAMMING Advanced CSS Techniques.
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
Tutorial 5 Working with Tables and Columns
Tutorial 5 Working with Tables and Columns
Week 5 Working with Tables. 2 Understanding Table Basics.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
IT Introduction to Website Development Welcome!
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
Chapter 5 Working with Tables Principles of Web Design, 4 th Edition.
CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS.
CONTROLLING Page layout
8/13/2003 Designing Without Tables Using CSS by Reshma Kumar and Marina Naito.
Stylizing a Navigational Menu Web Design Section 6-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
 Add one element at a time  If it doesn’t do what you want, › Delete it › DON’T just keep piling on more items.
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
Tutorial 5 Working with Web Tables. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Learn and Apply the structure of.
CSS. What does it stand for? Cascading Style Sheet.
>> CSS Layouts. Recall Properties of Box – Border (style, width, color) – Padding – Margin – Display – Background – Dimension Welcome Padding Area Border.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
Mimi Opkins.  One of the major benefits of using CSS is that you’re not forced to lay your sites out in tables.  The layout possibilities of CSS give.
CSS.
CSCI 1720 W3.CSS – Part 1 East Tennessee State University Department of Computing CSCI 1720 Intermediate Web Design.
CSS Layouts: Grouping Elements
Creating Page Layouts with CSS
Tables and Frames.
Advanced CSS BIS1523 – Lecture 20.
Introduction to Web programming
Cascading Style Sheets (Layout)
Creating a Baseline Grid
Introduction to Web programming
Styles and the Box Model
Fixed Positioning.
Laying out Elements with CSS
Presentation transcript:

Web Page Layout With CSS CSS Level 2 vs. Nested Tables Mike Wallick – 11/3/04

What is CSS? CSS stands for Cascading Style Sheets. Most common use is to remove tags from HTML pages. This is also know as CSS level 1. Example: highlighting a block of text:.highlighted { background: rgb(255,255,0); font-weight: bold; } CSS level 2, also known as CSS-P (positioning), uses style sheets to control a page’s layout, much like the traditional nested table approach.

Pros/Cons of Nested Table Layout Every mainstream web browser that I’m aware of supports tables. Simple table layouts are easy to learn and implement if you already understand HTML. Finding templates for traditional page layouts (header/footer with three columns in between) are relatively easy. Complex nested tables are error-prone due to the large amount of HTML code that must be used. Tracking down bugs in nested table layouts can be very difficult. For example, if you do have a bug in your table layout, some browsers will render the page correctly. The size of the HTML the client must download can get very large. HTML is not cached, at least not in the way images or style sheets are Large, complex nested table designs take longer for the browser to render.

Pros/Cons of CSS2 The HTML the client is required to download is smaller, improving page load times. Style sheets are downloaded once and cached like images and JavaScript files. You can truly separate presentation from content. The entire look of your site can be changed by applying a different style sheet (think, cell phone browser, text-only browser, screen reader applications). Site maintenance becomes much easier, as the HTML is much less complex and easier to debug. There are less “hacks” to code when considering compatibility for multiple browsers. Complex style sheets can get very large, somewhat offsetting the reduced HTML file size. There are several browsers that support CSS2, some better than others, but not every browser does. CSS2 is harder to learn than straight HTML.

Float: Taming ’s The CSS2 float element is used, this case, to style simple unordered ( ) lists. The sitenav is an example, using float:left to make the list elements lay out horizontally: TOOLS HELP DEPARTMENTS LOCATIONS WEB SITES PRODUCTS The corresponding CSS2 rules looks like this: div#sitenavback {min-width:800px; width:100%; border-top:1px solid black; border-bottom:1px solid black;} div#sitenav { margin: 0px; padding: 0px; width: 800px; height: 16px; } div#sitenav ul { margin: 0px; padding: 0px; list-style: none outside; } div#sitenav ul li { float: left; text-align: center; } div#sitenav ul li a { display: block; width: 105px; height: 16px; }

Here’s the with no styles applied Here’s the same code with the styles applied TOOLS HELP DEPARTMENTS LOCATIONS WEB SITES PRODUCTS div#sitenavback {min-width:800px; width:100%; border-top:1px solid black; border-bottom:1px solid black;} div#sitenav { margin: 0px; padding: 0px; width: 800px; height: 16px; } div#sitenav ul { margin: 0px; padding: 0px; list-style: none outside; } div#sitenav ul li { float: left; text-align: center; } div#sitenav ul li a { display: block; width: 105px; height: 16px; } Taming ’s

Rounded Corners Rounded corners are a bit easier using CSS2. Latest News New Corporate Travel Section Netscape Navigator Version 4 is No Longer Supported on the Intranet New Homeland Security Content on the Corporate Internet Web Page NEW Intranet Features! More Articles » Add an item - Edit/Delete div.roundcontent { background: rgb(229,229,229); } div.roundtop { background: url("images/tr") no-repeat top right; height: 15px; } div.roundbottom { background: url("images/br") no-repeat bottom right; height: 15px; } img.corner { width: 15px; height: 15px; display: block ! important; }

Latest News More » Add an Article - Edit/Delete Rounded corners with nested tables are a bit more difficult. Rounded Corners

Hacks/Workarounds/Bugs One advantage of CSS layouts over tabular layouts is the fact that there are less bugs/hacks/workarounds that you need to consider/deal with. Most notably, there is the Internet Explorer 3 pixel padding bug Top leftBottom right This is very easy to overcome using a very simple CSS rule: /* centercontent is the id of the where * the 3px padding occurs */ #centercontent { height: 50%; } Simply specify a height for the problem.

Hacks/Workarounds/Bugs Again, in Internet Explorer, there is a weird margin bug. Notice the white space next to the rounded corners. This only happens in IE, and again, the fix is very simple. Apply a negative 10 pixel margin, because the rounded gifs are 10x10 pixels..menu_curve_left { /* margin: top right bottom left; */ margin: 0px -10px 0px 0px; }.menu_curve_right { margin: 0px 0px 0px -10px; } » Tool Set Odd 10px margin -10px margin applied

Pros/Cons of this Layout Content is fairly separated from presentation The file size of the HTML has been reduced by about 20% (14KB to 11KB) The extra data the client is required to download are delivered in a cacheable format. Getting everything to line up “pixel perfect” was relatively easy. The layout grows and shrinks with the browser window. The layout works at 800x600. The additional style sheets add an additional 6KB of files to download. The overall download size for the HTML and stylesheets was a net increase to 17KB. The minimum screen resolution is for the layout to work “perfectly” is 1024x768 pixels. Since IE doesn’t seem to support the overflow:hide property, a Javascript workaround must be used for the center to allow the site to degrade to 800x600.

CSS Resources Below is a list of web sites that I found immensely useful in designing this layout. The W3C online resources reference: This is where I started and is where I discovered most of the sites below. css-discuss Wiki's rounded corner page: Not very practical, but the CSS Destroy ( has some pretty neat examples of CSS use/abuse. CSS Zen Garden ( shows just how powerful style sheets can be. This is the very first article that I read and started to work from: web.com/articles/web_page_reconstruction_with_css/. It talks about taking an existing tabular site and converting it to CSS level 2. web.com/articles/web_page_reconstruction_with_css/ An allegedly complete CSS2 reference site (I haven’t read the whole thing): A great CSS1 reference site with a little CSS2 thrown in (float, clear, etc.): I use this one frequently Probably the best resource I’ve found for explaining CSS-specific browser bugs and how to overcome them.

Additional Resources Charlie Kroger added these helpful links: