Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi I have a CSS codes in which when I "Restore Down" my browser, the font size in a table row will get shrunk as well. But when I try it, it did not work as expected. Below are my codes:
CSS
CSS
@media all and (max-width: 914px) {
     .ui-Title {
        font-size:12px; 
        padding-top:5px; 
        color:whitesmoke; 
        display:inline-block
    }
}


HTML
Razor
<td class="ui-Title" style="vertical-align:middle;font-size:x-large; font-weight:bold">
    MyTitle
</td>


What I have tried:

1. Try to search Internet for better understanding about CSS media class usage but found nothing.
Posted
Updated 20-Jul-16 1:37am

1 solution

The inline CSS will always take precedence over other CSS placements. In your case, the font size is supposed to be 12px for width up to 914px as dictated by media query, but inline CSS always overrides it to x-large. Remove the inline css and place it in the head section instead, e.g.
<style>
     .ui-Title {
        vertical-align:middle;font-size:x-large; font-weight:bold
    }

@media all and (max-width: 914px) {
     .ui-Title {
        font-size:12px; 
        padding-top:5px; 
        color:whitesmoke; 
        display:inline-block
    }
}
</style>


learn more: CSS How to[^]
 
Share this answer
 
v4
Comments
Karthik_Mahalingam 20-Jul-16 12:09pm    
5
Peter Leow 20-Jul-16 23:54pm    
Thank you, Karthik.
Jamie888 27-Jul-16 21:41pm    
Thank you for your help sir and sorry for the late reply as I was occupied with other tasks on hand. Thanks again.

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