Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Text not resizing with @media rule

Hlo im new to stackoverflow .
In my website , when i was trying to make it responsive with @media rule , its size is not changing. But other properties like color is working for me with media rule .
Can anyone help me with this ?

CSS CODE

@media (orientation: portrait) { 
  h2{
    font-size : 10px;
  }
 }

HTML CODE

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  <h2 style="padding-top: 300px;font-size:70px;" class="text-center"><u>MERRY CHRISTMAS</u></h2> 

>Solution :

Its due to the inline css inline css will take highest priority. If you define inline css rule inside <style> tag or a different css file it will work.

h2{
  font-size:70px
}
@media (orientation: portrait) {
  h2{
    font-size : 10px;
  }
 }
<h2>Merry Christmas</h2>

or else if you want to keep inline css, just add !important, as added below.

@media (orientation: portrait) {
  h2{
    font-size : 10px!important;
  }
 }

which is generally not a good practice

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading