Fluid Responsive CSS Font Size: Difference between revisions

From HaFrWiki42
Jump to navigation Jump to search
Created page with "{{TOCright}} == Introduction == Making Responsive Websites is not easy. Many examples are just made for just one part of the problem and seldom on the entire problem. Let me..."
 
Line 28: Line 28:
## Result in (not your real viewport, just an example):
## Result in (not your real viewport, just an example):
Viewport vh x vh : 836px x 1638px
Viewport vh x vh : 836px x 1638px
|}
<br>
{| class="wikitableharm" width="850px"
|-
! width="30%" | Viewport unit
! width="70%" | Description
|-
| {{FormFCTW|8|blue|bold|vw}}
| Viewport width, equivalent to JS window.innerWidth
|-
| {{FormFCTW|8|blue|bold|vh}}
| Viewport height, equivalent to JS window.innerHeight
|-
| {{FormFCTW|8|blue|bold|vmin}}
| Smaller value of the viewport’s width and height
|-
| {{FormFCTW|8|blue|bold|vmax}}
| Larger value of the viewport’s width and height
|}
|}
|}
|}



Revision as of 19:17, 9 August 2023

Introduction

Making Responsive Websites is not easy. Many examples are just made for just one part of the problem and seldom on the entire problem. Let me try to help, by creating this page, which is, of course, at-the-moment under construction.

Summary

Embracing fluid typography might be easier than you think. It has wide browser support, is simple to implement and can be achieved without losing control over many important aspects of design.

Source: Smashing Magazine, 2016, Fluid Typography [1]

Viewport

Text Code Javascript + jQuery

Viewport units making fluid typography on the web possible. Viewport units refer to a percentage of the browser’s viewport dimensions.

For example, 1 viewport width (vw) is equal to 1% of the viewport’s width.
The units differ from percentages because they are always relative to the viewport, whereas a percentage is relative to the element’s parent container.

## What is viewport's height and width using JS
$ console.log( "Viewport vh x vh : " + window.innerHeight + "px x " + window.innerWidth + "px" )

## Result in (not your real viewport, just an example):
Viewport vh x vh : 836px x 1638px


Viewport unit Description
vw Viewport width, equivalent to JS window.innerWidth
vh Viewport height, equivalent to JS window.innerHeight
vmin Smaller value of the viewport’s width and height
vmax Larger value of the viewport’s width and height

|} |}

See also

top

Reference

top

  1. Smashing Magazine, 2016 Fluid Typography, an article by Michael Riethmuller.