Code icon

CSS - MARGIN

Links


    // Margin
    Margin: 0 Con esto evitamos el scroll al sobrepasar los margenes si ponemos 100vh



    // Evitar Margin Collapse
    border: solid 1px transparent; //Establececiendo limite
    padding: // cualquier numero
    margin: 0; //menos elegante  


    // Centrado Horizontal
    margin: 15px auto; //El elemento (pejemplo div) debe tener width y el margen se establecerá automaticamente


    // Asignacion
    margin: 25px 50px 75px; top left/right bottom
    margin: 10px 3% 1em; 


    // Mejor unidad de medida
    rem
    em


    // ADVANCED MARGINS
    Negative margins (cannot be with padding)
    auto: needs to have a specified width and be inside an element with specified widht. Applies automatic margin on left/right to fill the parent
    margin-top: -20px;
    margin-left: -5px;
    margin: 0 auto;