-2

Possible Duplicate:
Multiple select options in one row

I have the following code but it generates it on separate lines, and I want it to be on a single line (only filling the parent which is not shown).

Also, how can I remove the text area's re-size feature?

<div id="search" align="left" style="width:100% height="100%">
<select>
    <option>Beers</option>
    <option>Cigars</option>
    <option>Wines</option>
</select>
    <div align="right">
        <form>
            <textarea style=width:"100%" height="100%" cols="0" "rows="0"></textarea>
        </form>
    </div>
</div>
Community
  • 1
  • 1
Jeremy
  • 3,620
  • 9
  • 43
  • 75

2 Answers2

2

here you go: http://jsfiddle.net/XeVdN/2 or see below:

<div id="search" style="float:left; width:100%; height=100%;">
<select stryle="float:left;">
    <option>Beers</option>
    <option>Cigars</option>
    <option>Wines</option>
</select>
    <div style="float:right;">
        <form>
            <textarea style="width:100%; height=100%; resize:none;" cols="0" "rows="0"></textarea>
        </form>
    </div>
</div>​

You had some issues with your styles (a few rogue " symbols) which I have cleaned up and also to get them to align, you just need to float the first element left and the second right.

For learning purposes, whenever you use the style attribute, you dont need to wrap each individual parameter in quotation marks, just the overall statement and follow every style with a ; as in the example code above.

JamieM23
  • 551
  • 2
  • 7
0

You want to use float. Remove the align attribute and use style="float:left; and style="float:right; for the other one.

Your current style attribute is also incorrect, please see the example below:

HTML:

<div id="search">
  <select>
    <option>Beers</option>
    <option>Cigars</option>
    <option>Wines</option>
  </select>
  <div id="other">
   <form>
     <textarea></textarea>
   </form>
  </div>
</div>​

CSS:

#search {
    width:50%;
    float:left;
}
#other {
    width:50%;
    float:right;
}
/*** This is what removes the textarea resize ***/
textarea {
    resize:none;
}

​ Working example here: http://jsfiddle.net/gN6Fz/

Oliver Tappin
  • 2,511
  • 1
  • 24
  • 43