Topic: Using empty divs as spacers Pages that link to <a href="https://ozoneasylum.com/backlink?for=11021" title="Pages that link to Topic: Using empty divs as spacers" rel="nofollow" >Topic: Using empty divs as spacers\

 
Author Thread
ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

IP logged posted posted 08-13-2003 20:29 Edit Quote

I need to create spacers using

<div style="display:inline;height:1px;width:10px"><!-- --></div>

This works perfectly in IE6 and Opera 7 but Mozilla will not honor the styles of an empty div. Any workarounds to this? I know I can use a scaled image but I am trying to avoid that if possible.

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

IP logged posted posted 08-13-2003 22:57 Edit Quote

"width" and "height" does not apply to elements displayed inline.
Describe what you're trying to achieve, there might be better ways.

ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

IP logged posted posted 08-13-2003 23:26 Edit Quote

I'm trying to align complex tables using divs as shims rather than scaled transparent gifs but if the css is invalid then I'll have to find another way. :-(

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 08-13-2003 23:42 Edit Quote

Using a div as a placeholder is no better than using a transparent gif as a placeholder. You're missing the spirit of CSS-based design.

1. Should you really be using a table in the first place?
2. If so, shouldn't you simply be using CSS to set the width of the table cell?

ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

IP logged posted posted 08-14-2003 00:05 Edit Quote

It's my boss who is missing the spirit of css among other things. If it were up to me I would do away with the tables altogether. Anyway I had used this idea previously in Proxomitron as a replacement for web bugs and I thought it might work here but I'll stick with the shims because that's what he wants.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 08-14-2003 01:43 Edit Quote

Eesh, what sort of project are you doing where your boss actually tells you how to write your HTML?

ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

IP logged posted posted 08-14-2003 03:07 Edit Quote

My boss is an MD who thinks he's a geek. I actually contracted with him to migrate his network to Windows. While I was at it he asked if I could help him clean up his web site but he has thus far vetoed my every suggestion. I've had it with him so as soon as I have finished training his employees how to use SOAPware I am getting out.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 08-14-2003 03:21 Edit Quote

ack

ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

IP logged posted posted 08-14-2003 07:07 Edit Quote

Sorry, I had a bad day.

ozphactor
Maniac (V) Inmate

From: California
Insane since: Jul 2003

IP logged posted posted 08-14-2003 07:13 Edit Quote

Just today? Everday sounds like a bad day, with that kinda boss...


So if he wants tables, and you want CSS, maybe go for hybrid solution.
Instead of a complex table, simplify it as much as your boss will allow, then handle the rest with CSS.

I've seen Zeldman do that kinda thing with some sites.

And as for spacers...

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 08-14-2003 08:54 Edit Quote

In any case, if you're required to use a table, I strongly recommend using the table-layout:fixed CSS property on it, which will cause it to behave much more intuitively than the default table-layout:auto. (Columns will take the width you give them, and remaining columns will divide the remaining space up evenly, provided you set a width for the table.)

You might also want to look at border-collapse:collapse, which can provide greater control in some ways.

ozphactor
Maniac (V) Inmate

From: California
Insane since: Jul 2003

IP logged posted posted 08-15-2003 07:17 Edit Quote

Wow, I've never even heard of those properties. Border-collapse? Table-layout? And I thought I knew CSS...


Mind pointing me to some resources on that?

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 08-15-2003 08:02 Edit Quote

http://www.w3.org/TR/CSS2/tables.html =)

ozphactor
Maniac (V) Inmate

From: California
Insane since: Jul 2003

IP logged posted posted 08-15-2003 08:04 Edit Quote

Ah, yes, the spec. Should've thought of that. Thanks.

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

IP logged posted posted 08-15-2003 16:52 Edit Quote

Try using

<div style="display:inline;height:1px;width:10px">&nbsp;</div>

-- not necessarily stoned... just beautiful.

ozphactor
Maniac (V) Inmate

From: California
Insane since: Jul 2003

IP logged posted posted 08-15-2003 22:01 Edit Quote

*sigh*

I just love selective readers...



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu