PDA

View Full Version : Tables with CSS?


animgirl
01-17-2003, 11:29 AM
Hello smart people :D

Is it improper to use tables with CSS or what???

Many thanks-a
animgirl

ByteWizard
01-17-2003, 01:02 PM
You will hear a lot of "anti-table" rhetoric here but all is aimed at the way tables are used for formatting. Cutting a web site into many, many blocks in order to style the web site is WRONG. There is a better way and that way as you have learned is CSS.

Tables have their place. If you need to present a group of information that is best served with tables, by all means use a table. For example, you maintain a site that lists the State name, the sales for that state, and the budget for that state, I would present this data in a 3 column table.

Data - YES... Formatting - NO

animgirl
01-17-2003, 01:08 PM
Yes, in that instance I have used it, but I also used it for a header, which I just learned would not be the way to do it. I don't understand though, how to make a stretchable header that has pictures here (http://www.alliancemusic.org/newversion) without using tables.

DCElliott
01-17-2003, 07:24 PM
OK OK already - I've been busy :cons:

I've attached some buttons using your background. They are centered, a bit stretchy, and use a contextual selector #squish a to do their thing.

I also made the heading super squishy with the potential to actually overlap the picture on the right over the Alliance picture. To do this I defined their divs as absolute. You then have to define an exact height for the header div containing them so that the content doesn't push up. Remember - absolutely positioned divs don't occupy space the same way relatively positioned divs do.

Don't overwrite your own code with the files - especially Alliance Home because I've changed it too much and dropped some stuff. Here is the main code for people's interest:

The CSS for the buttons:#squish a, #squish a:visited {
display : inline;
height:auto;
width:auto;
background-color: #656;
background: url(headerbackground.jpg) repeat #312031;
border: 2px outset #767;
margin:0 .5%;
padding:.2em .5%;
text-decoration:none;
line-height : 250%;
text-align:center;
color: pink;
}
#squish a:hover, #squish a:active {
border: 2px inset #767; color: bisque;
} and used in the HTML: <div id="squish">
<a href="biography.html">Biography</a>
<a href="newsletter.html">Newsletter</a>
<a href="devotions.html">Devotions</a>
<a href="engagements.html">Engagements</a>
<a href="pictures.html">Pictures</a>
<a href="recordings.html">Recordings</a>
<a href="contact.html">Contact</a>
<a href="index.html">Home</a>
</div> Simple, elegant. Please hold the applause.:cool:

animgirl
01-18-2003, 08:01 AM
Hey, thanks.

I'm gonna look through it and re-format my pages with it.

Many Many thanks :D

animgirl
01-18-2003, 10:18 AM
What is this for
<html xmlns="http://www.w3.org/1999/xhtml">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />

This new way of setting up the top
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 1st July 2002), see www.w3.org" />

<title>Alliance Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="STYLESHEET" href="alliance.css" type="text/css" />
<link href="favicon.ico" rel="shortcut icon" />
</head>

<body>

Is that a more modern way, or what?

What is the x-style for?
<div id="squish" xstyle="CLEAR: both">

Why do I need the background value of #656 if #312031 is the acutal background color?
background-color: #656;
background: url(headerbackground.jpg) repeat #312031;

I don't get what this is for:
<meta name="generator" content="HTML Tidy for Windows (vers 1st July 2002), see www.w3.org" />

I think that's it :)

animgirl
01-19-2003, 12:38 PM
I am believer in HTML tidy fur sure!

It's currently necessary for XML compliance.
Why the heck does it need to be XML compliant?

Thanks for the rest of the info, I kinda forgot to mention that DC kinda clarified those to me via e-mail, but there was some points that you covered.

So, thanks!

animgirl
01-19-2003, 12:49 PM
But, WHY does it need to be xhtml in the first place?

What's the point?

DCElliott
01-20-2003, 11:00 AM
Excellent reference DB.

ByteWiz - this one is a definite candidate for the Tool Box.

animgirl
01-20-2003, 11:56 AM
Hey,

Thanks for the ref.
It is kinda long, but I need to know all this stuff anywho.

Thanks again,
animgirl