Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select tag's OPTIONS aligned right

Tags:

html

css

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

like image 302
Jamal Abdul Nasir Avatar asked Jun 25 '10 13:06

Jamal Abdul Nasir


People also ask

How do I set align to the right in HTML?

Similarly, to right align a paragraph on the canvas with HTML's align attribute you could have: <P align="right">...

Which tag is used to align?

The <center> tag was used in HTML4 to center-align text.

Which attribute is used to align?

The HTML <p> align Attribute is used to specify the alignment of paragraph text content.


1 Answers

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;
}
like image 134
Richard JP Le Guen Avatar answered Oct 13 '22 13:10

Richard JP Le Guen