Forum Moderators: not2easy

Message Too Old, No Replies

Div Tags Inline

         

rockinthesixstring

3:27 am on Apr 25, 2008 (gmt 0)

10+ Year Member



Hey CSS guys, I am stuck on a small problem that I am sure once I am shown will really be one of those "Ah Ha" moments.

I am trying to display 3 div tags inline at the top of my page in order to have a "community server" style login "Tab" at the top of my page.

I have created

<div id="tab-container">
<div id="inner-tab-left">div>
<div id="inner-tab"><a href="#">Login</a> ¦ <a href="#">Register</a> ¦ <a href="#">Help?</a></div>
<div id="inner-tab-right"><div>
</div>

and then

#tab-container{height:40px}
#inner-tab-left{display:inline;height:40px;width:23px}
#inner-tab{display:inline;height:40px;}
#inner-tab-right{display:inline;height:40px;width:23px}

but that doesnt seem to be working. does anyone have any suggestions?

rockinthesixstring

6:04 am on Apr 25, 2008 (gmt 0)

10+ Year Member



Ok I got it, however I had to "hack" it a bit for FF and Safari
I had to put all the HTML on one line or it would render it with a space (&nbsp;)

<div id="tab-container">
<div id="inner-tab-left"><img src="App_Themes/Default/Images/tab_left.png" /></div><div id="inner-tab"><a href="#">Login</a> ¦ <a href="#">Register</a> ¦ <a href="#">Help?</a></div><div id="inner-tab-right"><img src="App_Themes/Default/Images/tab_right.png" /></div>
</div>

could that be because of DocType or something?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


#tab-container
{
float: right;
}
#inner-tab-left
{
display: inline;
}
#inner-tab
{
background-image: url(Images/tab_repeat.png);
background-repeat: repeat-x;
vertical-align: top;
display: inline;
padding-bottom:25px;
}
#inner-tab-right
{
display: inline;
}
a
{
margin: 0px;
padding: 0px;
vertical-align:top;
color:#0066cc;
}

g1smd

7:31 pm on Apr 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you really need XHTML for this?

*** [i]I had to "hack" it a bit for FF and Safari /i] ***

Less pain occurs when you design for Mozilla/Opera/Safari and then tweak for IE.

rockinthesixstring

7:58 pm on Apr 25, 2008 (gmt 0)

10+ Year Member



To be honest, I don't know. I just use the default doctype when I create a new aspx page in Visual Studio.

rockinthesixstring

7:59 pm on Apr 25, 2008 (gmt 0)

10+ Year Member



What DocType is recommended? And where can I find resources on the differences?

g1smd

11:23 pm on Apr 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'd use HTML 4.01 but whether you go for Transitional or Strict is open to debate. You can more easily validate your code to Transitional, I guess. There must be a prior discussion somewhere on webmasterworld with many useful clues.

rockinthesixstring

2:49 am on Apr 26, 2008 (gmt 0)

10+ Year Member



Cool, thanks... I will research.

swa66

3:00 am on Apr 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Any doctype will work, use one that you like.

Background info: WW has some groups that are anti-xhtml. A lot of us like xhtml and use it all the time. For this forum I think it's best to assume to use what you like best, and let's keep the xhtml vs. html4 discussions in their appropriate forum (i.e. not here).

I would however agree strongly with the recommendation to start in total disregard of IE and make it work there last (using conditional comments). It'll be a far less uphill battle if you do.

rocknbil

3:13 am on Apr 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not so sure what your seeing is anti XHTML, it's more akin to "right tool for the job." Document type and how you use CSS are pretty tightly intertwined.

What DocType is recommended? And where can I find resources on the differences?

Right here [webmasterworld.com]