将单行与文本区域对齐,并删除调整大小的功能



可能的重复:
一行中多个选择选项

我有以下代码,但它会在单独的行上生成,我希望它在一行上(仅填充未显示的父)。

另外,如何删除文本区域的重新尺寸功能?

<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>

在这里您要去:http://jsfiddle.net/xevdn/2或参见下文:

<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>​

您的样式有一些问题(一些流氓"符号),我已经清理了这些问题,也需要使它们对齐,您只需要浮动第一个元素,第二个元素左而右。

出于学习目的,只要您使用样式属性,就无需将每个参数包裹在引号,只有整体语句中,并以a的方式遵循每种样式;就像上面的示例代码一样。

您要使用float。删除align属性,然后将style="float:left;style="float:right;用于另一个属性。

您当前的style属性也不正确,请参阅下面的示例:

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;
}

工作示例在这里:http://jsfiddle.net/gn6fz/

最新更新