select tag's OPTIONS aligned right
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 R开发者_C百科IGHT 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;
}
You can use direction: ltr;
or direction: rtl;
for the direction of the text alignment
If I understand your question:
<select style="text-align:right;">
<option >asd</option>
<option>asdasd</option>
<option>asdasd</option>
<option>asdasd</option>
</select>
<option value="1" style="text-align: right;">
test?</option>
I know this is way later, but I know how to get the select box either to the left or right, I'm not sure how to get it up or down, but hopefully this will answer the questions of people searching for an answer, not necessarily for the OP.
<select style="float:right;">
<option >asd</option>
<option>asdasd</option>
<option>asdasd</option>
<option>asdasd</option>
</select>
Obviously, one could change it to style="float:left;", to justify it to the left.
精彩评论