bsr
bsr

Reputation: 58662

CSS: Div incorrectly positioned

I have uploaded a part of my screen below

It is part of a forum, so there are elements above and below it. The "Response Req.. Date" has a label, a date picker, and two drop down select control for time. I tried setting the width of the datepicker element, and a right margin so that the time selectors would position next to it. But it always sit below it.

<div class="wrapper ">
    <label for="responseRequiredDate">
        Response Required Date
        <span class="indicator">*</span>
    </label>
    <input type="hidden" name="responseRequiredDate" value="struct" /><div class="datetimepicker">
    <div class="datePicker"> 
    </div>        
    <script> ...</script>
    <div class="timepicker"><select ....
    </div> </div>

the date picker insert a script tag, would that cause a problem. probably not.

the computed css from firebug is given below. the only style currently different from inherited is display:inline .. I tried float, clear, margin etc without success. so removed them for clarity.

datePicker :

font-family verdana,arial,helvetica,sans-serif
font-size   12.8px
font-weight 400
font-style  normal
color   #222222
text-transform  none
text-decoration none
letter-spacing  normal
word-spacing    0
line-height 20.7833px
text-align  start
vertical-align  baseline
direction   ltr
Background
background-color    transparent
background-image    none
background-repeat   repeat
background-position 0 0
background-attachment   scroll
opacity 1
Box Model
width   auto
height  auto
top auto
right   auto
bottom  auto
left    auto
margin-top  0
margin-right    0
margin-bottom   0
margin-left 0
padding-top 0
padding-right   0
padding-bottom  0
padding-left    0
border-top-width    0
border-right-width  0
border-bottom-width 0
border-left-width   0
border-top-color    #222222
border-right-color  #222222
border-bottom-color #222222
border-left-color   #222222
border-top-style    none
border-right-style  none
border-bottom-style none
border-left-style   none
Layout
position    static
display inline
visibility  visible
z-index auto
overflow-x  visible
overflow-y  visible
white-space normal
clip    auto
float   none
clear   none
-moz-box-sizing content-box
Other
cursor  auto
list-style-image    none
list-style-position outside
list-style-type disc
marker-offset   auto

Timepicker:

font-family verdana,arial,helvetica,sans-serif
font-size   12.8px
font-weight 400
font-style  normal
color   #222222
text-transform  none
text-decoration none
letter-spacing  normal
word-spacing    0
line-height 20.7833px
text-align  start
vertical-align  baseline
direction   ltr
Background
background-color    transparent
background-image    none
background-repeat   repeat
background-position 0 0
background-attachment   scroll
opacity 1
Box Model
width   auto
height  auto
top auto
right   auto
bottom  auto
left    auto
margin-top  0
margin-right    0
margin-bottom   0
margin-left 0
padding-top 0
padding-right   0
padding-bottom  0
padding-left    0
border-top-width    0
border-right-width  0
border-bottom-width 0
border-left-width   0
border-top-color    #222222
border-right-color  #222222
border-bottom-color #222222
border-left-color   #222222
border-top-style    none
border-right-style  none
border-bottom-style none
border-left-style   none
Layout
position    static
display inline
visibility  visible
z-index auto
overflow-x  visible
overflow-y  visible
white-space normal
clip    auto
float   none
clear   both
-moz-box-sizing content-box
Other
cursor  auto
list-style-image    none
list-style-position outside
list-style-type disc
marker-offset   auto

Upvotes: 3

Views: 450

Answers (3)

marty
marty

Reputation: 1

display: inline; Should fix your problem.

Upvotes: 0

pederOverland
pederOverland

Reputation: 890

Well, a div that's not floated will always push the next content below itself. You can try to set display:inline on the div, or make it into a span.

Upvotes: 1

stefanglase
stefanglase

Reputation: 10402

You should display those div-boxes as inline elements:

.datePicker, .timepicker {
    display: inline;
}

Upvotes: 1

Related Questions