HighDots Forums  

Tables to CSS conversion problems

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Tables to CSS conversion problems in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ian N
 
Posts: n/a

Default Tables to CSS conversion problems - 06-14-2006 , 04:52 AM






Hi,

I'm trying to convert an existing table based navigation to CSS,
however i'm having problems mimicking the way the original table
behaves.

My original HTML is this : -

<table class="top_nav">
<tbody><tr>
<td class="spacer"></td>
<td><a href="#">home</a></td>
<td><a href="#">your<br>item 1</a></td>
<td><a href="#>item 2</a></td>
<td><a href="#">item 3</a></td>
<td><a href="#">item 4</a></td>
<td><a href="#">test<br>item 5</a></td>
<td class="spacer"></td>
</tr>
</tbody></table>

My new HTML and CSS that i've attempted is this : -

#navlist li
{
display: inline;
list-style-type: none;
padding-right:5px;
}
div.top_nav li { color: #000000; font-weight: bold;
width: 10%; text-align: center;
vertical-align: middle; }
div.top_nav li.spacer { width: 5%; }
div.top_nav a { color: #000000; text-decoration: none; padding: 1px
5px 2px 5px;}
div.top_nav a:hover { color: #FFFFFF; text-decoration: none; }


<div class="top_nav mainLayout">
<ul id="navlist">
<li><a href="#">home</a></li>
<li><a href="#">your<br>item 1</a></li>
<li><a href="#">item 2</a></li>
<li><a href="#">item 3</a></li>
<li><a href="#">item 4</a></li>
<li><a href="#">test<br>item 5</a></li>
<ul>
</div>

I've tried using the word-wrap: break-word; and setting the width of
the li's but this isn't working, i presume because they're set to
display inline rather than block.

Basically i need a way to split the longer text items into two lines as
it was in the original menu system.

Would anyone be able to help or has any suggestions?

Thanks in advance,

Ian


Reply With Quote
  #2  
Old   
Jim Moe
 
Posts: n/a

Default Re: Tables to CSS conversion problems - 06-14-2006 , 05:36 PM






Ian N wrote:
Quote:
I'm trying to convert an existing table based navigation to CSS,
however i'm having problems mimicking the way the original table
behaves.

This is one of those areas where the transition from table-layout to
HTML+CSS does not work very well. Tables and table cells have different
properties than other elements. Sometimes you just can't get there.
Quote:
div class="top_nav mainLayout"
ul id="navlist"
<li><a href="#">home</a></li
<li><a href="#">your<br>item 1</a></li
<li><a href="#">item 2</a></li
<li><a href="#">item 3</a></li
<li><a href="#">item 4</a></li
<li><a href="#">test<br>item 5</a></li
ul
/div

[...] i presume because they're set to
display inline rather than block.

True.
One way to do this is #navlist li {display:table-cell;}. But since IE
does not support that, it is not really an option.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.