473,668 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Markup table with css?

How can I replace/override the table attributes align, border,
cellpadding and cellspacing with css?
Mar 9 '06 #1
7 1940
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@hot mail.com.invali d> wrote:
How can I replace/override the table attributes align,
table {
text-align:$alignmen t;
vertical-align:$alignmen t; }
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>
--
______PretLette rs:
| 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********@hot mail.com.invali d> wrote:
How can I replace/override the table attributes

align,


table {
text-align:$alignmen t;
vertical-align:$alignmen t; }


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**@w3develop ment.de>
wrote:
Barbara de Zoete wrote:
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@hot mail.com.invali d> wrote:
How can I replace/override the table attributes

align,

table {
text-align:$alignmen t;
vertical-align:$alignmen t; }


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

I'm not really sure what you mean? Can you exlain a bit further please?
--
______PretLette rs:
| 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**@w3develop ment.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********@hot mail.com.invali d> 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******@pretl etters.net> wrote:
On Thu, 09 Mar 2006 13:04:40 +0100, Jef Driesen
<je********@ho tmail.com.inval id> wrote:
How can I replace/override the table attributes

align,


table {
text-align:$alignmen t;
vertical-align:$alignmen t; }


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**@w3develop ment.de>
wrote:
Barbara de Zoete wrote:
On Thu, 09 Mar 2006 13:16:58 +0100, Johannes Koch
<ko**@w3develop ment.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
:-)

--
______PretLette rs:
| 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
3602
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 was very nice when Netscape ruled the World Wide Web, and http://valet.htmlhelp.com/page/why.html which is very suggestive but does not really give any factual example. Is there something to be _shown_ to people who ask "why validate?"? A page...
4
3924
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 has been suggested before that I should have the navigation menu at the end of the HTML, so that a screen reader doesn't have to read it to get to the content, with the possible exception of having
6
1784
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
2936
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 markup hall of shame, ;-)
9
2563
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 validator: -------------------------------------------------------------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD>
2
1749
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 datagrid column: <asp:TemplateColumn> <ItemStyle CssClass="TableData" Width="15%"></ItemStyle> <ItemTemplate> <a href="<%# ShowURL(DataBinder.Eval(Container.DataItem,
0
1161
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 file upload feature through an asp.net intranet ap to bulk insert data into our databases - the function works fine provided the file does not have format issues. The process also requires some knowledge of excel and that users don't get
7
2644
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 sieben
7
2409
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
1983
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 page. I want to use something like a repeater or something like that. I don't know if this would be code I will have to manually write myself, or if it can be done with dataBinding of some sort. I am using vs2008 and c# 3.5. Any ideas on how to...
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.