469,926 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

why is border="1" not realy a border with 1 px ?

Hi,

I want to have a table with a border of 1px arround it but table="1" is more
than a pixel because this 3d effect is attached.
Values below are not accepted
How can I get this border with 1px
can someone give me any hints ?

thanks for any help

Rolf
Jul 20 '05 #1
5 14518
"Rolf Brauser" <fa******@a1.net> writes:
I want to have a table with a border of 1px arround it but table="1" is more
You mean border="1", I assume?
than a pixel because this 3d effect is attached.
Values below are not accepted
How can I get this border with 1px
can someone give me any hints ?


In CSS:
table { border: 1px black solid; }
Or a different colour of your choice.

--
Chris
Jul 20 '05 #2
Rolf Brauser wrote:
I want to have a table with a border of 1px arround it
table { border: 1px solid black }
but table="1" is more than a pixel because this 3d effect is
attached. How can I get this border with 1px


I'm confused. Do you want to replicate the border="1" attribute in css?
If so, then forget the above and use this:

table { border-collapse: collapse }
td { border: 1px solid black }

That will work in Opera, Moz, and others, but not IE. If you add
cellspacing attribute, then IE will also play nice.

<table cellspacing="0"><!-- etc. -->

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
You mean border="1", I assume?


Thanks for your help, now it works as I want
Sorry bout the confusion , I meant border = "1" not table="1"
Rolf
Jul 20 '05 #4

"Brian" <us*****@julietremblay.com.invalid> schrieb im Newsbeitrag
news:10*************@corp.supernews.com...
Rolf Brauser wrote:


Thanks for your help, now it works as I want
Sorry bout the confusion , I meant border = "1" not table="1"
Rolf
Jul 20 '05 #5
On Thu, 5 Aug 2004 14:01:58 +0200, "Rolf Brauser" <fa******@a1.net>
wrote:
Hi,

I want to have a table with a border of 1px arround it but table="1" is more
than a pixel because this 3d effect is attached.


What you are seeing is not just one border but several borders. You
have to understand how the table presentation model works to know
what's going on here.

Here's a quick ASCII-art diagram. You might need to copy it into a
text editor like Windows Notepad if your email client isn't configured
to use a fixed-width font.

+-------------------------- <--- table border
| <--- table padding/cell margin
| +-----------------+ +- <--- cell border
| | | | <--- cell padding
| | Hello, world | |
| | | |
| | | |
| | | |
| +-----------------+ +-
|

As my diagram hopefully illustrates, there are two borders in play
here. The deprecated HTML BORDER attribute for table changes the width
of all of these borders at once. The CELLSPACING attribute changes the
size of what I've marked as the "table padding/cell margin" in my
above diagram -- the space between the two borders. CELLPADDING
controls the space between the cell border and the content of the
cell.

These HTML attributes don't give you much flexibility and are
deprecated anyway. CSS gives you more options.

In the CSS table model, the above diagram still applies but you can
control each of those properties separately. You can, if you want,
have a five-pixel cell border and a one-pixel table border, or have
different border types on each side of the cell. I assume since you
asked an HTML question in a stylesheets group that you aren't familiar
with CSS, so I suggest you go and have a look for a good CSS tutorial.

Once you've learned how CSS works, you can then find out about the
collapsed borders model, which is a special mode where the two borders
in the above diagram collapse together and the intervening
margin/padding is ignored. Through this you can achieve the one-pixel
borders you want.

Here's an example, but if you don't know CSS this probably won't mean
much to you yet:

table {
border-collapse: collapse;
}
table, td, th {
border: 1px solid;
}

Once you've read up on CSS you'll know what to do with this code, and
you can read all about the CSS border model in the CSS specification:
http://www.w3.org/TR/REC-CSS2/tables.html#borders

The CSS spec isn't light reading, though. You'd be better served with
a tutorial first so that you can better understand the specification.

All the best,
-Claire
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

40 posts views Thread by Greg G | last post: by
4 posts views Thread by Manuel Faux | last post: by
21 posts views Thread by Evan Sussman | last post: by
2 posts views Thread by spifster | last post: by
5 posts views Thread by balakrishnan.dinesh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.