How does reveal.js resize elements?


Tags: javascript,html,css,reveal.js

Problem :

I am trying to understand how reveal.js ( http://lab.hakim.se/reveal-js/#/ ) resizes elements dynamically.

To see this, adjust the height of the page and see how elements (to a certain degree) shrink as the page shrinks.

However, using chrome inspector, I cannot see how this shrinking is actually happening, either in CSS or Javascript.

(My interest comes from wanting to improve it, if possible, but I was surprised how hard it was to figure out how it works at all.)



Solution :

Have you heard of media queries? This is a technique deployed through CSS that allows you to affect the styling of elements based on the width and height of the window. Here is how it's used for reveal.js https://github.com/hakimel/reveal.js/blob/master/css/reveal.css

@media screen and (max-width: 900px), (max-height: 600px) {
    .reveal .slides {
        font-size: 0.82em;
    }
}

@media screen and (max-width: 700px), (max-height: 400px) {
    .reveal .slides {
        font-size: 0.66em;
    }
}

Read On: MDN CSS Media Queries

Mini Tut: CSS Media Queries & Using Available Space | CSS-Tricks


    CSS Howto..

    How to achieve chamfered CSS Border Corners rather than rounded corners?

    CSS: How to make an input box stretch to the width of its given absolute position left and right value?

    Three column responsive equal height, with border. How to make it in CSS?

    How to make links in line

    How to set class on div that is inside of repeater in code behind?

    jQuery - How to animate text simultaneously to color change transition

    CSS - How to create diagonal emboss?

    How to style Repeater item background color ontap?

    How to create nested diamond shape using CSS?

    How to create a DIV with vertical scrollable contents and fixed footer which is always visible?

    CSS position: absolute - understanding how to center text inside a div box

    Validatation error “Value Error : background-position Too many values or values are not” How to solve?

    How to embed css in xml?

    How to use css and images to create a rounded header section in an HTML page?

    how to make dropdown using html and css?

    How to only make a css element appear on one page?

    How to set a menu as selected while selecting its subchild

    How to start different elements on different keyframes of an animation in CSS

    How does Mashable.com displays/hides an element through Css?

    jQuery to hide and show divs with an indicator

    How to position two blocks side by side with CSS

    How to resize a Java Script element to fit its container window

    How to optimize CSS code?

    CSS how to align one word left and another word right within the same div?

    How to have a horizontal line at the middle of a html heading with CSS?

    How to get a textarea to fill in the height of a table column?

    How to use one icon from different image files?

    How to align specific element to the right using :last-child pseudo

    How to make google maps fit the mobile device screen

    How to clear the (CSS) visited history of an Android WebView?