tags:

views:

58

answers:

2
+3  Q: 

css positioning

Hello,
I have uploaded a part of my screen below (link: http://yfrog.com/0d30127380p) alt text

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. I'm not good in css positioning, so any suggestion would be highly appreciated.

<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. please let me know if u need addition info.

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
+1  A: 

You should display those div-boxes as inline elements:

.datePicker, .timepicker {
    display: inline;
}
codescape
it didnt work.. though i could see the css applied in Firebug.
bsreekanth
A: 

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.

Pjotrovitz
i tried float:right on timepicker div, and added right margin + set width on the datepicker, expecting the timepicker to go inline, but it didn't. though i applied clear after the style, remaining controls in the pages are also floated right.. I know, i am missing someting, but not intuitive for me :-(
bsreekanth
span didn't work, may be because, each of time and date picker has many contained div in it..
bsreekanth
Your timepicker has the clear:both property set, this makes it go below any preceding element. You could try to make both block elements(display:block), remove the clear properties and add float:left.
Pjotrovitz
that was it... thank you for the help.
bsreekanth