Web Masters Tips and Tricks.

The Basics cont.

After you have decided whether or not to color your scrollbars you might consider your presentation next. I am a firm believer in using XHTML and CSS. If you have taken a look at my design you might have noticed that it relies almost exclusively on mathematics. The more advanced mark-up language that you decide to use will pretty much dictate how much control you will have over its appearance. I am a math and science guy and am hungry to exercise as much control as possible over how my work displays in all browsers. Using XHTML 1.1 and CSS allows maximum control and most websites written in this language appear the same in all browsers with a minimal amount of "hacks" written into the code. "Hacks" are adjustments written into the CSS code that allow you to program your code for more than one browser type. For years Internet Explorer browsers were non - compliant with CSS and had to be dealt with accordingly. Bill Gates (Microsoft), in co-operation with Intel, was having Internet Explorer installed on all new computers and exercising an unfair market advantage over all the other browsers. You had to go to a website and download different browsers and most people just never made it and Internet Explorer became number one.
An example of a typical hack might look like this:

<head>

<style type="text/css">
DIV#mainbox{
border: 1px solid #000;
padding: 6px;
padding-top:0px;
background-color:white;
text-align: center;
border-collapse: collapse;
margin-bottom:0px;
}

html>body #mainbox{
margin-left:0px;
margin-right: 2px;
margin-top: 0;
padding-bottom: 2px;
}
</style>

</head>

The html>body element identifies the hack. This particular "hack" deals with padding and margin issues that differ between the Internet Explorer browser and other mainstream browsers. Seems pretty simple, huh? This sort of points at what I was referring to earlier about math giving you more control. The Div#mainbox (the # in the code denotes the id attribute) is written for the mainstream browsers and the "hack" deals with CSS compliant browsers (non - I.E.). Did you notice how I opened the door to boxes? "The box" is probably the pre-eminent display element in CSS coding today. "Boxes are everything", remember you heard it here first.
An example of a box used as a display element might look like this:

<head>

<style type="text/css">
DIV#crestwrapper{

width: 130px;
height: 151px;
border: 0;
background-image:url(images/1fitea1.jpg);
background-repeat: no-repeat;
background-position: center center;
margin:auto;
}
</style>

</head>

<body>

<div id="crestwrapper"></div>

</body>

Back to top of Page

The CSS code that you have just read is what makes the crest and coat of arms display at the top of this page. This page you are looking at is merely a "box" mathematically positioned over a purple background. Still with me? Let me break down the previous "style code snippet" definition for you. The call, from within the body, is self explanatory. The first two lines deal with the dimension of the graphic used and coincidentally the exact size of the box. Back in the old days you could just use numbers, in today's world you will need to use a unit of measurement - px (pixel). You will have a lot more choices as far as units of measurement go when you specify distances such as padding and margins. You can build the box larger and change the background color to frame whatever graphic you are using. There is an endless list of things you can do with your display once you master "the box". The next line deals with the border of the box. Here comes the control factor. You could probably leave this out and rely on the defaults of whatever browser you or your viewers use but why chance it? The next line specifies how you will be populating your box. You call the image from your image file on your server. A good webmaster will have all of his or her images in a separate file so as not to clutter-up and confuse your directory. The next line refers to whether or not you are tiling your image. Due to the slight differences in the way "some browsers" handle padding and margin issues I will set this to "no repeat". That way, even though I have set the box dimensions to the same size as the graphic, the image will not repeat itself to try to fill any potential gaps. The next line deals with the positioning of the graphic within the box. As a matter of good form I always specify the horizontal and vertical position as center, as long as that is what I am trying to achieve. Last but not least there is the "margin:auto" attribute. This will center the box horizontally on your page. You can specify up to three different margin commands as long as you place these changes after the margin:auto command. Keep in mind that by default any element introduced will automatically be positioned at the top and on the left side of any page or element. To change the margin-left attribute will throw off the whole thing so in reality you only have top, bottom, and right to make adjustments with after the margin:auto command.
Believe it or not I still like to use tables for some applications. Boxes are a wonderful thing but when it comes to positioning three or four elements in the same display it gets pretty tricky. You can have as many columns as you wish inside your display box but once you begin to rely 100% on CSS for positioning, inside of your display, it becomes increasingly complex. It ultimately becomes an access issue as well. The next topic in my tutorial will be Accessibility. Actually accessibility is a huge topic and I will only be touching on the important high points.
This discussion will begin on the next page of my tutorial.

[[a]Home ] [[b]Introduction to the Website ] [[c]About the Authors of the Book ] [[d]Foreword ] [[e] Johannes Vogt - The Tennessee Branch ] [[f]Leonard Fite - Isabella Fite ] [[g]Descendents of Leonard & Margaret ]   [[h]Willy Green Fite - James Monroe Fite ] [[i]Thomas Bethel Fite - Flennoy Elgar Fite ] [[j]Clarence Sydney Fite - Effie Gladys Fite ] [[k] Marion Charles Fite - Lucille Fite ] [[l]Arra Burton Fite - Bernice Mabel Fite ] [[m] Frederick Leroy Fite - Elizabeth Fite Thorne ] [[n]LaFayette Doris Fite - Ella Mae Fite ] [[o] Julia Bruton - Paul Leonard Fite ] [[p]The Source ] [[q]Content ] [[r]Explanation of the Coat of Arms ]  [[s]Links Page ] [[t]Privacy / COPPA Statement ] [[u]Accessibility Statement ] [[v] Copyright Statement ] [[w]Updates Page ] [[x]Disclaimer / Terms of Use ] [[y]Site Map ]  [[z]Reflections ] [[1]Web Master Tips-I ] [[2]Web Master Tips-II ] [[3]Web Master Tips-III ] [[4] Web Master Tips-IV ] [[5]Web Master Tips-V ] [[6]Award Pages Index ] [Rated Awards (5.0) I ] [Rated Awards (5.0) II ] [Rated Awards (5.0) III ]  [Rated awards (4.5) I ] [Rated awards (4.5) II ] [Rated awards (4.0) I ] [Rated awards (4.0) II ] [Rated Awards (3.5) I ] [Rated Awards (3.0) I ]  [Rated Awards (3.0) II ] [[7]Independent Awards ] [[8] ICRA Labeled ] [[9]XHTML 1.0 ] [[0]CSS Level 3 ]