what CSS style am I missing here?

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hi

asp.net 3.5

I want the first 2 divs to be displayed on the same row, but when I run this
in IE7 each div has it's own line:

example of how it's displayed:
dd.mm.yyyy
HelloWorld

example of how I want it to look:
dd.mm.yyyy HelloWorld

(the max width is 369px, so more than enough to have 2 divs on the same
line)

<td valign="top" style =" background-color:Yellow;">
<div style="background-color:Green; width:120px;"> <<<----- div #1
<asp:Literal ID="litDate1" runat="server" ></asp:Literal>
</div>
<div style="background-color:Purple; width:120px;"> <<<------ div #2
<asp:Literal ID="litTitle1" runat="server"></asp:Literal>
</div>
<div style="background-color:Aqua;">
<asp:Literal ID="litContent1" runat="server"></asp:Literal>
</div>
</td>

any ideas?
 
hi

asp.net 3.5

I want the first 2 divs to be displayed on the same row, but when I run this
in IE7 each div has it's own line:

example of how it's displayed:
dd.mm.yyyy
HelloWorld

example of how I want it to look:
dd.mm.yyyy   HelloWorld

(the max width is 369px, so more than enough to have 2 divs on the same
line)

<td valign="top" style =" background-color:Yellow;">
 <div style="background-color:Green; width:120px;">  <<<----- div #1
     <asp:Literal ID="litDate1" runat="server" ></asp:Literal>
 </div>
 <div style="background-color:Purple; width:120px;">    <<<------div #2
     <asp:Literal ID="litTitle1" runat="server"></asp:Literal>
 </div>
 <div style="background-color:Aqua;">
     <asp:Literal ID="litContent1" runat="server"></asp:Literal>
 </div>
</td>

any ideas?

Hi Jeff

try

<td valign="top" style =" background-color:Yellow;">
<div style="background-color:Green; width:120px;float:left">
<<<----- div #1
<asp:Literal ID="litDate1" runat="server" ></asp:Literal>
</div>
<div style="background-color:Purple; width:120px;float:right">
<<<------ div #2
<asp:Literal ID="litTitle1" runat="server"></asp:Literal>
</div>
<div style="background-color:Aqua;">
<asp:Literal ID="litContent1" runat="server"></asp:Literal>
</div>
</td>

Hope this helps
 
I want the first 2 divs to be displayed on the same row, but when I run
this in IE7 each div has it's own line:

example of how it's displayed:
dd.mm.yyyy
HelloWorld

example of how I want it to look:
dd.mm.yyyy HelloWorld

(the max width is 369px, so more than enough to have 2 divs on the same
line)

<td valign="top" style =" background-color:Yellow;">
<div style="background-color:Green; width:120px;"> <<<----- div #1
<asp:Literal ID="litDate1" runat="server" ></asp:Literal>
</div>
<div style="background-color:Purple; width:120px;"> <<<------ div #2
<asp:Literal ID="litTitle1" runat="server"></asp:Literal>
</div>
<div style="background-color:Aqua;">
<asp:Literal ID="litContent1" runat="server"></asp:Literal>
</div>
</td>
Use the Display property and put it inline instead of block
Look at this site:
http://www.w3schools.com/css/pr_class_display.asp
W3Schools has some good tutorials.
 
Back
Top