Shyju
Shyju

Reputation: 218942

CSS : Div coming as next line

I have this HTML in my page

  <div id='masterDIV'>
    <div id='divItemNumber'>23</div>
   <div id='divDesc'>This is my desc content</div>
  </div>

and my Style

.divItemNumber
 {
 width:25px;
 margin-left:0px;
  margin-bottom:5px;
 }
.divDesc
{
 width:255px;
 float:right;
 padding-left:1px;
 padding-right:1px;
 margin-left:0px;
 margin-bottom:5px;
 margin-top:0px;
 vertical-align:top;
}

But the second div is coming as the next line. I want this to be displayed adjucent right after the first div (divITemNumber)

This problem comes in IE 6.0 only .in firefox its rendering properly

Can any one help me ?

Upvotes: 1

Views: 2629

Answers (3)

rahul
rahul

Reputation: 187110

One problem is that your CSS selector is not correct.

You have to use

#divDesc

instead of

.divDesc

to select the div with id divDesc

Read

ID selectors

Upvotes: 4

Franci Penov
Franci Penov

Reputation: 76021

I would suggest changing you CSS so that the first div is float: left and the second is normal.

Alternatively, changing the first div from a block type element to an inline type element (display: inline) should fix the problem.

Upvotes: 0

Cam Soper
Cam Soper

Reputation: 1509

Add this to your CSS div classes:

display: inline;

Upvotes: 2

Related Questions