473,386 Members | 1,748 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,386 software developers and data experts.

really easy tables question

Hi,

I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.

What I have is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtm11/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head><title>crap</title>
<style type="text/css">
table {border: 2px;
font-size: 16pt;
color: blue;
}
</style>
</head>
<body>

<table>
<tr>
<tdtest test</td>
<tdtest2 test2</td>
</tr>
<tr>
<tdcrap crap </td>
<tdtest3 test3</td>
</tr>
</table>

</body>
</html>

Why do I not get a 2pixel border? Or any border?

Thanks for your help

Michael
Oct 8 '06 #1
8 1513
Michael wrote:
I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.
There's nothing special about tables when it comes to borders in CSS.
What I have is:
table {border: 2px;
So, that would be:

border-width: 2px;
border-style: none;

then?

(and don't forget the border-color).
font-size: 16pt;
Point units considered harmful on screen:
http://css-discuss.incutio.com/?page=UsingPoints

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 8 '06 #2
On 2006-10-08, Michael wrote:
Hi,

I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.

What I have is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtm11/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head><title>crap</title>
<style type="text/css">
table {border: 2px;
font-size: 16pt;
color: blue;
}
</style>
</head>
<body>

<table>
<tr>
<tdtest test</td>
<tdtest2 test2</td>
</tr>
<tr>
<tdcrap crap </td>
<tdtest3 test3</td>
</tr>
</table>

</body>
</html>

Why do I not get a 2pixel border? Or any border?
You must specify the type of border, e.g.:

table {
border: 2px solid;
}

And perhaps the color, as well:

table {
border: 2px solid black;
}
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Oct 8 '06 #3
Scripsit David Dorward:
There's nothing special about tables when it comes to borders in CSS.
Actually there's quite a lot special, like border-collapse. But for the
border around a table itself, there's nothing different from the general
border concept in CSS.

What puzzles people who move from presentational HTML to using CSS is that
when you set a border for a table, you only set a border for the table
element as a whole. That's really the "nothing special" thing in CSS terms,
but it differs essentially from the effect of, say, <table border="2">.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Oct 8 '06 #4
On Sun, 8 Oct 2006 16:51:21 +0800, "Michael" <mi*********@yahoo.com>
wrote:
>Hi,

I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.

What I have is:
snip>>>>>>>>>>
>
Thanks for your help

Michael
Hi Michael,

There is a site that gives about 80 samples of CSS table design. Some
are more than a little over the top but I have always found it useful
to at least see how they do it:

http://icant.co.uk/csstablegallery/index.php

All the best,

Andrew
--

Andrew
http://www.andrews-corner.org/
Oct 8 '06 #5

"David Dorward" <do*****@yahoo.comwrote in message
news:eg*******************@news.demon.co.uk...
Michael wrote:
>I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.

There's nothing special about tables when it comes to borders in CSS.
>What I have is:
table {border: 2px;

So, that would be:

border-width: 2px;
border-style: none;

then?

(and don't forget the border-color).
> font-size: 16pt;

Point units considered harmful on screen:
http://css-discuss.incutio.com/?page=UsingPoints

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is

ahhhhhh! I knew it was something stupid.
Thanks for that

Michael
Oct 10 '06 #6

"Michael" <mi*********@yahoo.comwrote in message
news:45**********************@per-qv1-newsreader-01.iinet.net.au...
>
"David Dorward" <do*****@yahoo.comwrote in message
news:eg*******************@news.demon.co.uk...
>Michael wrote:
>>I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.

There's nothing special about tables when it comes to borders in CSS.
>>What I have is:
table {border: 2px;

So, that would be:

border-width: 2px;
border-style: none;

then?

(and don't forget the border-color).
>> font-size: 16pt;

Point units considered harmful on screen:
http://css-discuss.incutio.com/?page=UsingPoints

--
David Dorward <http://blog.dorward.me.uk/>
<http://dorward.me.uk/>
Home is where the ~/.bashrc is


ahhhhhh! I knew it was something stupid.
Thanks for that

Michael

Hmmmm.....

Now I have:

table {position: absolute;
top: 150px;
left: 150px;
border-width: 2px;
border-style: none;
font-size: 16pt;
}

I know the page is using the stylesheet because if I change the font-size it
changes, but I still have no border........

Thanks for your help

Regards

Michael
Oct 11 '06 #7
In article
<45**********************@per-qv1-newsreader-01.iinet.net.au>,
"Michael" <mi*********@yahoo.comwrote:
"Michael" <mi*********@yahoo.comwrote in message
news:45**********************@per-qv1-newsreader-01.iinet.net.au...

"David Dorward" <do*****@yahoo.comwrote in message
news:eg*******************@news.demon.co.uk...
Michael wrote:

I'm trying to use a table and format it with CSS, but I cant get it to
render with a border. I know this is really easy, but I can't see what I
have wrong and when I search for tables and CSS I just get lots of stuff
about using tables for layout etc.

There's nothing special about tables when it comes to borders in CSS.

What I have is:
table {border: 2px;

So, that would be:

border-width: 2px;
border-style: none;

then?

(and don't forget the border-color).

font-size: 16pt;

Point units considered harmful on screen:
http://css-discuss.incutio.com/?page=UsingPoints

--
David Dorward <http://blog.dorward.me.uk/>
<http://dorward.me.uk/>
Home is where the ~/.bashrc is

ahhhhhh! I knew it was something stupid.
Thanks for that

Michael

Hmmmm.....

Now I have:

table {position: absolute;
top: 150px;
left: 150px;
border-width: 2px;
border-style: none;
font-size: 16pt;
}

I know the page is using the stylesheet because if I change the font-size it
changes, but I still have no border........
It helps to consult the CSS specs for border-style:

none
No border. This value forces the computed value of ¹border-width¹
to be ¹0¹.
hidden
Same as ¹none¹, except in terms of border conflict resolution [p.
264] for table elements [p. 245] .
dotted
The border is a series of dots.
dashed
The border is a series of short line segments.
solid
The border is a single line segment.

http://www.w3.org/TR/REC-CSS2, for future reference!
Oct 11 '06 #8
Michael wrote:
>>So, that would be:
border-width: 2px;
border-style: none;
then?
border-style: none;
So now you're setting it to none explicitly, instead of having none because
its the default. None is, however, still none.
>>(and don't forget the border-color).
You're still forgetting the border colour.
>>Point units considered harmful on screen:
http://css-discuss.incutio.com/?page=UsingPoints
font-size: 16pt;
Point units are still considered harmfil, avoid them.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 11 '06 #9

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

Similar topics

3
by: Martin Mrazek | last post by:
Hi, I have tables named like ag97a027, ag98a027, ... where 97 and 98 is from year 1997, 1998 and a027 is just specification of product type. I need carry out repeated operataions over these...
21
by: Mel | last post by:
i see a lot of stuff going back and forth, tables are easy to use and do exactly what the name says it does ROWS/COLUMNS what is a GOOD reason to use DIVs instead ? thanks Mel
72
by: Mel | last post by:
Are we going backwards ? (please excuse my spelling...) In my opinion an absolute YES ! Take a look at what we are doing ! we create TAGS, things like <H1> etc. and although there are tools...
5
by: LedZep | last post by:
What up, All I need to do is enter a last name in a text box, query a MSAccess database and display the name with the corresponding columns. This is no problem, but when there are more than one...
2
by: tnks | last post by:
hi i have a data grid (i fill when i run the program) then the user insert rows and i wana save.. i used SqlClient.SqlCommandBuilder but it fail, just save 1 recordr, some times 2 records,...
10
by: cj | last post by:
I have lots of tables to copy from one server to another. The new tables have been created to match the old ones. I practiced with one table. I created the select command (select * from tableA)...
15
by: sparks | last post by:
We get more and more data done in excel and then they want it imported into access. The data is just stupid....values of 1 to 5 we get a lot of 0's ok that alright but 1-jan ? we get colums...
1
by: wildman | last post by:
It's been over 10 years that I don't look at Access. I've been working in asp.net for the last 5 developing intranet sites. Just got a project where we are trying to avoid building an...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.