选择标签的OPTIONS右对齐 [英] select tag's OPTIONS aligned right

查看:245
本文介绍了选择标签的OPTIONS右对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将选择元素的OPTIONS的容器向右对齐...默认情况下,在控件的左下角显示OPTIONS ...



h2_lin>解决方案

虽然其他答案是正确的,你可以使用 style 属性,你最好使用外部CSS档案。



在HTML文件中,将< link> $ c>< head> :

 < head> 
< title>示例< / title>
< link type =text / css =stylesheethref =path / to / the / file.css/>
< / head>

提供< select> < option> )元素a class 属性。

 < select class =JamalAbdulNasir> 
< option class =Jamal> Jamal< / option>
< option class =Abdul> Abdul< / option>
< option class =Nasir> Nasir< / option>
< / select>

在您的样式表中包括一个CSS规则,目标是< select& c>

$


$ b $ .JamalAbdulNasir {
text-align:right;
}

...或< option& / code>标签。

  input.Abdul {
text-align :对;
}


i want to align container of the OPTIONS of the select element to the right... the default is showing OPTIONS on the LEFT BOTTOM of the control...

so how will i show OPTIONS aligned to the RIGHT BOTTOM of the select element?

take care...

解决方案

While the other answers are correct, and you can use the style attribute, you'd be better off using an external CSS file.

In your HTML document, add a <link> to your CSS file in the <head> of the document:

<head>
    <title>Example</title>
    <link type="text/css" rel="stylesheet" href="path/to/the/file.css" />
</head>

Give your <select> (or the <option>) element a class attribute.

<select class="JamalAbdulNasir">
    <option class="Jamal">Jamal</option>
    <option class="Abdul">Abdul</option>
    <option class="Nasir">Nasir</option>
</select>

In your style sheet include a CSS rule which targets that <select> tag by class attribute.

select.JamalAbdulNasir {
    text-align:right;
}

... or the <option> tag you want to be right-aligned.

input.Abdul {
    text-align:right;
}

这篇关于选择标签的OPTIONS右对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆