How to implement fluid font size using pure CSS


Tags: html,css,fluid-layout

Problem :

I have text wrapped in <div>s, and would like to make the whole thing fluid including the font-size of the text, i.e. the text resizes itself in response to the size of the containing element.

I came across a Javasript + CSS solution, but just wondering if it is possible to do so with pure CSS?



Solution :

Yes, look at CSS 3 media queries. You can provide different style rules depending on the viewport width. This includes altering the font size.


    CSS Howto..

    How to copy external CSS and JavaScript in XSLT

    How can vertically center a chunk of line-wrapping text next to an image?

    How to “break line” via CSS?

    Overlay image to show like panorama [closed]

    How to expand input field to 100% of the parent

    how to make the entire form (input and submit button) change border color on focus (bootstrap 3)

    CSS: how to make the font icon and text under it closer?

    How to add Button over image using CSS?

    How to position an element just off the top of the browser viewport using only css?

    How to get inputs in the same line with css?

    CSS - How to add a second background image

    How to make my CSS responsive

    css: how to surround an image with two other images vertically centered around the first one?

    How to hide a parent div if an inner div has a certain class, with javascript

    CSS3 Menu Layout and Gradient not showing

    How to center three DIVS with other HTML tags inside one parent DIV [duplicate]

    Polymer 1.0 how can I style a paper-input:disabled?

    How to NOT select only specific elements in a table with jQuery?

    How to make div stack first vertically then horizontally? [duplicate]

    How to Automatically adjust width in CSS so horizontal scrollbars would adjust automatically without taking so much space?

    How to reference image locations in css asset hosted on a different domain?

    How can i remove all attributes from any css selector? To override and reset any css id selectors?

    How do I make text-transform:uppercase work properly with Greek?

    css: How to make elements not to overlap + automatically place them in a relevant position

    How to set out css properly?

    How to move this structure to the right without using float?

    CSS - How make the page scroll over the edge of the window

    Css selector : How to reference a attribute inside a div

    Show div on radio button check using JS fallback

    How to align with digits inside to the right, jQuery