spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

Boxing with CSS, Part II: No Margin For Error

Exercises


Developer News
Eclipse Helios Update Brings New PHP Tools
Internet Explorer 9 Ups Standards Support
JBoss Portal 5 Release Easier to Use

This concludes our two-part introduction to the CSS visual formatting model. By now, you know how to control the box model properties, and how to do simple layout of block elements one after the other. The following excercises will help you get the bigger picture of how these methods are put into action despite browser bugs.

Explorer Challenge

Take the document below, and try to make it look like it should if it had the following style sheet:

BODY {
  margin: 1em;
  padding: 1em;
}
DIV {
  padding: 1em;
  margin: 1em;
  border: 1em solid green;
  background: cyan;
}
P {
  padding: 1em;
  margin: 1em;
  border: 1em solid blue;
  background: magenta;
}

The style sheet you use should be legal CSS, and not create any bizarre effects if tried on Navigator or according to the specification. Any one who manages to do this, tell me how and you'll get an honorary mention in this tutorial.

<BODY>

<DIV>

<P>Acme Computer Corporation is a technology-based 
company that seeks to offer its customers the latest 
in technological innovation. Our products are created 
using the latest breakthroughs in computers and are 
designed by a team of top-notch experts.</P>

<P>We are based in Acmetown, USA, and have offices 
in most major cities around the world. Our goal is to 
have a global approach to the future of computing. Have 
a look at our product catalog for some examples of our 
innovative approach.</P>

</DIV>

</BODY>

Netscape Coloring

Take the document above, and make both paragraphs have a square green background, with a white background on the body, without any borders showing.

Front Page1234567

http://www.internet.com

Produced by Stephanos Piperoglou

webref The latest from WebReference.com Browse >
Flashmaps' DynamicLocator: Interactive Maps for Small Areas · Flashmaps' AreaSelector: Interactive Maps for Wide Areas · The DB Mapper: Interactive Street-level Maps of U.S. and Canada
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags


All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/html/tutorial10/
Created: Dec 2, 1998
Revised: Jan 27, 1999