CSS equivalents for attributes

S

Steve Pugh

Jeff Thies said:
That's odd, not only does it work but google yields pages of uses. I
don't doubt that you are right though. I've never had a need for it
until this moment.

I think the HTML spec trumps Google...

middle is an allowed value for the align attribute of <img>, it is not
an allowed value for the align attribute of <td>.

http://www.w3.org/TR/html401/struct/objects.html#adef-align-IMG
http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD

What's more, browsers tend to error correct <td align="middle"> by
treating it as <td align="center">.

Confused yet? ;-)

There is no valign attribute for <img> so this doesn't follow from the

The CSS vertical-align is equivalent to both the <td> valign attribute
and _some_ of the values of the <img> align attribute. Confusion is
understandable. Middle is an allowed value in both cases.

Steve
 
S

Steve Pugh

David Dorward said:
Argh! Shows how often I use presentational HTML attributes!

Oh, well played sir. Turning a simple mistake into a virtue. A truly
masterful move. If I was wearing one I would take my hat off to you.
;-)

Steve
 
M

Mitja

Brian said:
For some odd reason, there's been a slew of partially
correct
responses in this thread, and more heat then I'd expect
from such a simple question. Being foolish, I now stick
my head in the lion's mouth.



<table cellspacing="0">
<!-- cellspacing is still required for IE 5.x Mac, which
does not recognize CSS border-spacing or border-spacing
property -->

table {
border-collapse: collapse;
/* this will cause adjacent borders in table
to 'collapse' into one border */
}

td {
border: 1px solid black; /* borders around each cell */
padding: 3px; /* padding within each cell */
}


table img { /* assuming this image is inside the table */
vertical-align: middle;
}

And now, I wait to be shown how *I've* screwed up.

Right above :)
vertical-align should be set for the containing element (i.e. td), not the
contained (i.e. img).

Also, with border-collapse:collapse, cellspacing=0 is unnecessary
Here's
a preemtive :p.

What's that do after P? Drooling? :)
 
R

Rupe

The "px" in "0px" might be unnecessary but for 2 reasons I would
recommend to add it even in such case:

Yeah! why have these silly 'time saving' rules which are bound to cause
errors? also like you don't have to have a semicolon on the end of the last
declaration in a block, 'cos that wastes *so much* time!

RU
 
S

Stan Brown

Dylan Parry said:
The specifications clearly state that units are _optional_ when a zero
value is given. I'm sure you know the meaning of the word "optional" and
understand that it is not incorrect to specify units in a zero case.

Indeed I do. That's why I said "unnecessary" rather than
(your word) "incorrect".

Sheesh! Object to what I say, if I'm wrong, but it's a bit much to
have people object to something in their own minds that I didn't
say!

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
 
B

Brian

Mitja said:
Right above :) vertical-align should be set for the containing
element (i.e. td), not the contained (i.e. img).

As I said, I was waiting to be shown up. I could note that vertical
align is applicable to inline elments, but that would be a dodge,
since the op was talking about a translation of table layout.
Also, with border-collapse:collapse, cellspacing=0 is unnecessary

Hold on there, cowboy. Cellspacing=0 most certainly is necessary, for
the reasons already given. (Look at the comments I put in my code
example.)
What's that do after P? Drooling? :)

I was looking at someone eating ice cream. (Mmmm, ice cream....)
 
M

Mitja

Brian said:
As I said, I was waiting to be shown up. I could note
that vertical align is applicable to inline elments, but
that would be a dodge, since the op was talking about a
translation of table layout.


Hold on there, cowboy. Cellspacing=0 most certainly is
necessary, for the reasons already given. (Look at the
comments I put in my code example.)

I think there's a typo in those comments. You clearly meant border-collapse
and yes, I did overlook it (BTW, NN4.x doesn't recognize it either) - mea
culpa.
 
D

Davmagic .Com

From: (e-mail address removed)
(Jeff Thies)
There's a number of elements that I set
attributes for:
<table border="1" cellpadding="3"
cellspacing="0">..
<img align="middle">
Are there CSS equivalents for any of
these?

After reading thru all the "do this's" but "don't do that's" and other
rubbish in all the replys in this thread... you'd be better off sticking
with plain ole tables and their align, cellpadding, cellspacing, and
border attributes and other positioning align attributes of other tags!
CSS can have it's limits and the replys here have shown that...

Web Design, Magic, Painting, Junking, More
http://www.davmagic.com
Paint A House
http://www.paintahouse.com
NOTE: This emailbox is CLOSED do NOT reply!!!
 
B

Brian

Mitja said:
I think there's a typo in those comments. You clearly meant
border-collapse and yes, I did overlook it

I didn't notice my typo. It should have read "...does not recognize
border-spacing or border-collapse property".

As I feared, I think I may have confused matters more by trying to
correct the mistakes I saw.
(BTW, NN4.x doesn't recognize it either)

There's a lot NN4 doesn't recogize. And a lot it *does* recognize but
botches badly. At this point, I assume www authors do the simple and
sensible thing of hiding all CSS from that browser so that its users
can access the page without any real trouble.
 
J

Jeff Thies

Davmagic said:
After reading thru all the "do this's" but "don't do that's" and other
rubbish in all the replys in this thread... you'd be better off sticking
with plain ole tables and their align, cellpadding, cellspacing, and
border attributes and other positioning align attributes of other tags!

No.

When you've worked with web design long enough you find the most
important thing is site maintainability.

Simpler designs with styles set in stylesheets are far easier to
maintain/change/update. Particularly over multiple pages.

If you are into design, it's far easier to get precise designs with CSS
than nested tables. I've ripped apart multiply nested tables and
replaced it with a fraction of the html and gotten exactly what they
couldn't achieve. Tables still have their place, if there was a float:
farleft this would be less true.

What prompted my particular case is that I wanted to turn on borders and
set cellpadding without having to edit the html.

Jeff
 
B

Beauregard T. Shagnasty

Quoth the raven Davmagic .Com:
After reading thru all the "do this's" but "don't do that's" and other
rubbish in all the replys in this thread... you'd be better off sticking
with plain ole tables and their align, cellpadding, cellspacing, and
border attributes and other positioning align attributes of other tags!

Why would you recommend 1990's technology to someone simply because
you don't understand it?

CSS can do lots of stuff with tables. This page of mine is quite simple:
http://www.countryrode.com/sales/stockpre.asp
CSS can have it's limits and the replys here have shown that...

CSS is limited only by the imagination of the author. <g>
 
K

Kris

After reading thru all the "do this's" but "don't do that's" and other
rubbish in all the replys in this thread...

Blahdiblahblahdiblahdiblah. Have fun playing with Mr. Webcastmaker here,
but call if you need to go potty.
 
M

Mitja

Brian said:
I didn't notice my typo. It should have read "...does not
recognize border-spacing or border-collapse property".

As I feared, I think I may have confused matters more by
trying to correct the mistakes I saw.


There's a lot NN4 doesn't recogize. And a lot it *does*
recognize but botches badly.
Oh yessss:)
Just today I had to patch up a site to look a bit less revolting in NN4. The
little joys of life...
At this point, I assume www
authors do the simple and sensible thing of hiding all
CSS from that browser so that its users can access the
page without any real trouble.
Hiding all css might be going a bit far. At least some borders, backgrounds
and such are welcome to show the structure of the page more clearly.
 
B

Brian

Mitja said:
Hiding all css might be going a bit far.

I must disagree. Its reported use is 5% or lower, and dropping.
At least some borders, backgrounds and such are welcome to show the
structure of the page more clearly.

Sure. But it takes too much effort to figure out what *won't* make the
page explode in Netcape 4.x. I used to do it. Debugging, one CSS
property at a time, is quite labor-intensive, with not much payback.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top