Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
in my project i have define the font size and font family for all the textboxes using Style sheet. code is
input[type="text"]
{
font:13px Arial, sans-serif;
text-transform:uppercase;
}

it is working fine. but now i need to change font for some textboxes. so i have create class in the same style sheet. code is
.fontchange
{
font:15px 'Times New Roman';
font-weignt:bolder;
text-transform:none;
}

i use this class for some of the textboxes. the font and weight are not changed but the text-transform is changed. i have installed the font in my machine. still it is not working. if i change the font for every text box like

<input id="txtName" font-family="fontname" type="text"/>
it is working. but i don't want this.i need to create a style in css file. i don know why class in css file not working can any one plz help me

thanks in advance
Posted
Updated 14-Aug-13 8:27am
v3

This is done all the time and this is why CSS are called "cascading".

You never show where you reference fontchange. For example:
XML
<input type="text"/><br/> <!-- should show your default 13px font -->
<input type="text" class="fontchange/> <!-- should show your changed 15x font -->


—SA
 
Share this answer
 
v3
For font name, you can try the "font-family". With the weight, did you typed correctly "font-weight" and its property (bold, normal,...)?
 
Share this answer
 
Try to update css as mentioned below (i have added '!important') :

.fontchange
{
font:15px somefontname !important;
font-weignt:somefontweight !important;
}
 
Share this answer
 
Comments
satsri46 14-Aug-13 14:45pm    
Thanks its working!!!
You'll need to make the selector more specific. input[type="text"] takes preference over .fontchange. So change it to input[type="text"].fontchange instead.

You can always check what style is applied using the browser's development tools (or in case of Firefox, download Firebug[^]).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900