Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the font size smaller when I resize the browser

Tags:

I am making a website with html5 and css. I am trying to make this website responsive, but I don't know why the size of the font stay the same when I resize the browser window, even when I'm using em or percentages such as: font-size: XXem or font-size: XX%.

How can I make font resizable?

like image 485
user2804038 Avatar asked Nov 30 '13 19:11

user2804038


People also ask

How do I reduce the font size in my browser?

Press and hold the Ctrl key, then move the mouse wheel up or down. Alternatively, you can press and hold the Ctrl key (or Command on Mac), then press + or - (plus or minus) to increase and decrease the font size. All major browsers also support pressing Ctrl + 0 (zero) to change the font to its default size.

How do I automatically adjust font size in HTML?

Syntax: font-size-adjust: number|none|initial|inherit; Below are the examples that illustrates the use of font-size-adjust property.

How do I stop a browser window from resizing after a specific size?

You can not control the size of the window. You can use CSS to set min-width and min-height properties to ensure your page layout stays sane. using 'window. open' I can open a page with a fixed height width.


2 Answers

For HTML5 web pages I would highly suggest using Viewpoint Width/Height values. They function similarly to % but are font sizes that resize with the window.

For example...

.some-paragraph{     font-size: 5vw; } 

This would set the font-size to always be 5% of the current viewport width, even on re-sizing!

Learn more here: http://www.w3.org/TR/css3-values/#viewport-relative-lengths

Note: You may need to have this in your head:

 <meta name="viewport" content="initial-scale=1"> 
like image 87
Victor3y Avatar answered Oct 11 '22 12:10

Victor3y


It's called Responsive

@media screen and (max-width: 1024px) { your font  style goes here  }  @media screen and (max-width: 950px) {  your font  style goes here  }   @media screen and (max-width: 650px) {  your font  style goes here   }  @media screen and (max-width: 480px) {  your font  style goes here  } 
like image 21
San Avatar answered Oct 11 '22 10:10

San