I have this simple HTML dropdown menu:
<select>
<option style="font-size:50px;">Test</option>
</select>
I can't find a way to increase the font size of the option. The font-size property is being ignored for some reason. Is this a bug or what?
Thanks
To change the font style by option dropdown: The font values can be passed in option tags using option value. The value attribute specifies the value to be sent when a form is submitted. So after the value to be sent is selected, we set the fontFamily property for the text in the element to the selected value as specified in the above syntax.
Always use the proper HTML tags, like <h1> - <h6> for headings and <p> for paragraphs. The font-size value can be an absolute, or relative size. Note: If you do not specify a font size, the default size for normal text, like paragraphs, is 16px (16px=1em). Tip: If you use pixels, you can still use the zoom tool to resize the entire page.
Note: If you do not specify a font size, the default size for normal text, like paragraphs, is 16px (16px=1em). Tip: If you use pixels, you can still use the zoom tool to resize the entire page. To allow users to resize the text (in the browser menu), many developers use em instead of pixels.
So after the value to be sent is selected, we set the fontFamily property for the text in the element to the selected value as specified in the above syntax. In the javascript function, here changeFontStyle (), the fontFamily property value is set to the font value of the option selected. By default, it is set to Times New Roman.
Have you tried putting it on your <select>
element?
<select style="font-size:50px;">
<option>Test</option>
</select>
fiddle: http://jsfiddle.net/tCw8M/
Or with a stylesheet:
select {
font-size: 50px;
}
fiddle: http://jsfiddle.net/tCw8M/2/
The font size option needs to be on the select tag, not the option tag:
<select style="font-size:50px;">
<option >Test</option>
</select>
Whether you do it directly to the tag or in a css file selecting the tag is up to you.
You should turn off the default OS styling with: -webkit-appearance: none
;
DEMO here
You have to apply the style in select
not in option
like:
select{
font-size:50px;
}
fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With