12.09.2015 Views

Boot Camp

Web Authoring Boot Camp - StudioBast

Web Authoring Boot Camp - StudioBast

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In this example, the style rule would be:<br />

Page Layout Code - Part 2<br />

div {width: 100px; padding: 10px; border: 5px solid black; margin: 10px; }<br />

The top box is the standard - when this element is given a width of 100px, the width affects<br />

only the white portion, and the additional padding, border and margin affect the areas<br />

you see in gray.<br />

Internet Explorer, however, interprets the width of 100px to be the “width” referred to the<br />

area within the outer edges of the black borders, but not including the margins. This has<br />

been corrected in IE 8, but the bad news is that web authors still need to design web pages<br />

that can be accurately viewed in earlier browsers, especially IE6 and 7.<br />

As a result, you may find that pages which lay out properly in Firefox and IE 8 have<br />

troubles in IE 7 and earlier. How do you deal with this? Well, with much coffee, cursing,<br />

threats to the computer, and patience, you can do a couple of things.<br />

• Create conditional style sheets. One would default to most browsers, and another<br />

would be specified for IE6 and older IE browsers, with style differences that affect<br />

the box model irregularities. This tends to be the simplest and most easy to maintain,<br />

plus minimizes side effects of CSS hacks and conditional code.<br />

• Use conditional comments in HTML source code, which are conditional statements<br />

interpreted by Microsoft Internet Explorer. Conditional comments first<br />

appeared in Microsoft’s Internet Explorer 5 browser and are supported through at<br />

least version 8.<br />

• Use of CSS filters or hacks, which are a coding technique used to hide or show<br />

CSS markup depending on the browser, version number, or capabilities. Browsers<br />

have different interpretations of CSS behavior and different levels of support for<br />

the W3C standards. CSS filters are sometimes used to achieve consistent layout<br />

appearance in multiple browsers that do not have compatible rendering. Keep in<br />

mind that box model hacks have proven unreliable because they rely on bugs in<br />

browsers’ CSS support that may have been fixed in later versions.<br />

Since a web author’s goal is to create and maintain as clean and pure of code as possible,<br />

you want to avoid CSS hacks and conditional code as much as possible.<br />

DIV Page Layouts<br />

The table structure for website layout offers much more control than simply designing a<br />

page from top to bottom (primeval HTML). However, tables have serious limits for posi-<br />

217

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!