473,395 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Markup table with css?

How can I replace/override the table attributes align, border,
cellpadding and cellspacing with css?
Mar 9 '06 #1
7 1922
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@hotmail.com.invalid> wrote:
How can I replace/override the table attributes align,
table {
text-align:$alignment;
vertical-align:$alignment; }
border,
table, th, td {
border:$length $type $color; }
cellpadding
th, td {
padding:$length_top $length_right $length_bottom $length_left; }
and cellspacing


table {
border-spacing:$length; }

See <URL:http://www.w3.org/TR/CSS2/> and
<URL:http://www.w3.org/TR/REC-CSS2/propidx.html>
--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 9 '06 #2
Barbara de Zoete wrote:
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@hotmail.com.invalid> wrote:
How can I replace/override the table attributes

align,


table {
text-align:$alignment;
vertical-align:$alignment; }


Isn't table/@align something like float in CSS?

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Mar 9 '06 #3
On Thu, 09 Mar 2006 13:16:58 +0100, Johannes Koch <ko**@w3development.de>
wrote:
Barbara de Zoete wrote:
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@hotmail.com.invalid> wrote:
How can I replace/override the table attributes

align,

table {
text-align:$alignment;
vertical-align:$alignment; }


Isn't table/@align something like float in CSS?

I'm not really sure what you mean? Can you exlain a bit further please?
--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 9 '06 #4
Barbara de Zoete wrote:
On Thu, 09 Mar 2006 13:16:58 +0100, Johannes Koch
<ko**@w3development.de> wrote:
Isn't table/@align something like float in CSS?

I'm not really sure what you mean? Can you exlain a bit further please?


I thought, the effect of
<table align="left"> ...
is not the same as
table { text-align: left }
but
table { float: left }
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Mar 9 '06 #5
Jef Driesen <je********@hotmail.com.invalid> wrote:
How can I replace/override the table attributes align, border,
cellpadding and cellspacing with css?


align="left" and align="right" are equivalent to float: left; and
float: right; align="center" is equivalent to margin-left: auto;
margin-right: auto; (you must be triggering Standards mode in IE6 for
this last one to work, and it doesn't work at all in IE5).

border is just border. But in CSS the borders on the table and on the
cells are set separately.

cellpaddin is just setting padding on the td and th elements.

cellspacing is border-spacing but hasn't been very well supported in
IE up to now (anyone bothered to check in the IE7 beta yet?) unless
you want to set cellspacing="0" in which case border-collapse:
collapse; has the same effect.

So, something like
<table border="2" cellspacing="2" cellpadding="2" align="center">

would be replicated (with some differnces between browsers) by:
table {
border: 2px outset;
border-spacing: 2px;
border-collapse: separate;
margin-left: auto; margin-right: auto;
}
th, td {
padding: 2px;
border: 1px inset;
}
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Mar 9 '06 #6
"Barbara de Zoete" <tr******@pretletters.net> wrote:
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@hotmail.com.invalid> wrote:
How can I replace/override the table attributes

align,


table {
text-align:$alignment;
vertical-align:$alignment; }


The HTML align attribute when applied to the table element affects the
alignment of the whole table, not the alignment of the text within the
table cells. In other words, table {text-align: right;} is not the
same as <table align="right">.

text-align and vertical-align would be appropriate to replace the
align and valign attributes of td and th.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Mar 9 '06 #7
On Thu, 09 Mar 2006 13:23:03 +0100, Johannes Koch <ko**@w3development.de>
wrote:
Barbara de Zoete wrote:
On Thu, 09 Mar 2006 13:16:58 +0100, Johannes Koch
<ko**@w3development.de> wrote:
Isn't table/@align something like float in CSS?

I'm not really sure what you mean? Can you exlain a bit further please?


I thought, the effect of
<table align="left"> ...
is not the same as
table { text-align: left }
but
table { float: left }


Looking at Steve's reply too, you're absolutely right. I never knew that
:-)

--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 9 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Jukka K. Korpela | last post by:
As well all know, valid markup is important... but when trying to find a convincing modern argument in favor of this, I found pages like http://www.htmlhelp.com/tools/validator/reasons.html which...
4
by: Dave Patton | last post by:
Using my About page as an example: http://members.shaw.ca/davepatton/about.html What is the best/proper way to markup a page such as this that has "the main body" and "a navigation menu"? It...
6
by: Christopher Benson-Manica | last post by:
I have some markup like the following: <form> <table> <script> <!-- Write the table markup //--> </script> </table> <form>
16
by: J. C. Denton | last post by:
I just manually validated alexa's global top 100 sites and find only 2 sites that pass validation. They are http://www.microsoft.com/ http://www.wikipedia.org/ All others should go w3c...
9
by: Jamie | last post by:
Maybe I am mis-understanding the function of the W3C Markup validation Service at validator.w3.org, but shouldn't it pick up errors like below? You can cut & paste this straight into the...
2
by: Joe | last post by:
Hello All: I am writing to ask for your opinions. I have a colleague who combines his code with the markup used to display the code (reckoning back to classic ASP). Here's an example of a...
0
by: Jason | last post by:
Hi I wanted to bounce an Idea off you guys. I'm not sure if it's possible or even how to implement it .. or possibly if I'm trying to re-invent the wheel. Our users currently use excel and a...
7
by: Andreas Prilop | last post by:
I'm looking for an appropriate markup for a dictionary/glossary. A dummy example is English German eight acht five fünf four vier nine neun one eins seven ...
7
by: R. Rajesh Jeba Anbiah | last post by:
What would be the ideal HTML markup for the following list of records (except table)? Student-1: Marks: Math : 100 Science : 100 History : 100 Student-2:
8
by: Andy B | last post by:
I have the object property StockContract.Dictionary which is a dictionary collection of <string, stringkey/value pairs. I need to be able to retreive the keys and their values and display them on a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.