Pesquisar neste blog

14/08/2020

Overflow em HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Overflow</title>
    <style>
        div{
            font-size: 40px;
            height: 100px;
            width: 260px;
            border: solid 3px;
            overflow: hidden;
            /*overflow: scroll;overflow nos 2 sentidos*/
            overflow-x: scroll;/*só faz a rolagem na horizontal*/
            overflow-y: scroll;/*só faz a rolagem na vertical*/
            
        }
    </style>
</head>
<body>
    <div>
        TudoFuncionouMuitoBemEmCSS!!!
        Texto muito grande para caber nessa div.
        Já pensou qual será o comportamento padrão ?
    </div>
</body>
</html>



 

Propriedade Display em HTML

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Display</title>
    <style>
        body {
            font-size: 40px;
            color: #fff;/*cor do texto*/
            background-color: coral;/*cor do plano de fundo*/
        }

        ul{padding: 0;}
        div{background-color: seagreen;}/*cor de fundo da div*/
        span{ background-color: red;}
        li{ background-color: purple;}

        div, span, li{ 
            width: 50%; /*largura*/
            width: 200px;
            height: 80px;/*altura*/
            padding-top: 30px;
            text-align: center;/*texto centralizado*/
            /*display: block;/*blocos*/
            /*display: inline;/*linhas*/
            display: inline-block;

        }
    </style>
</head>

<body>
    <div>Texto 1</div>
    <span>Texto 2</span>
    <span>Texto 3</span>
    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
</body>

</html>


Modelo de box 02 em HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Box Model</title>
    <style>
        /*  */
        body{ font-size: 80px; margin: 0;}
        .c1{background-color: orange;}
        .c2{background-color: yellow;}
        .c3{background-color: tomato;}

        div{
            float: left;/*elementos à esquerda*/
            padding-top: 100px;
            padding: 10px 50px 100px 150px;/*largura*/
            padding: 100px 50px;/*comprimento*/
            padding: 50px;
            margin: 0px 20px;/*margem apenas na horizontal*/
            border: solid 15px black;/*borda tamanho 15 cor preta*/
        }

    </style>
</head>
<body>
    <div class="c1">1</div>
    <div class="c2">2</div>
    <div class="c3">3</div>
</body>
</html>


 

Modelo de box 01 em HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Herança</title>
    <link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
    <style>
        body{
            font-family: 'Oswald', sans-serif;
            font-size: 20px;/* tamanho da fonte*/
            border: solid 3px red;
            margin: 10px 100x 150px;/*10 em cima/baixo e 100 nas laterais*/
        }

        div{
            border: inherit;
            padding: inherit;
        }
    </style>
</head>
<body>
    <h1 style="font-size: 3em">Herança</h1>
    <div>Estou herdando
        <span><p>
            teste
        </p></span>
    </div>
</body>
</html>



 

Herança em HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Herança</title>
    <link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
    <style>
        body{
            font-family: 'Oswald', sans-serif;
            font-size: 20px;/* tamanho da fonte*/
            border: solid 3px red;
        }

        div{
            border: inherit;
            padding: inherit;
        }
    </style>
</head>
<body>
    <h1 style="font-size: 3em">Herança</h1>
    <div>Estou herdando
        <span><p>
            teste
        </p></span>
    </div>
</body>
</html>



Espeficidade 2 em HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Especificidade CSS</title>
    <!-- https://specificity.keegan.st -->
    <style>
        body{
            font-size: 40px;
        }
        /* selecionando todas as div */
        div{
            background-color: blue;
        }
        /* selecionando as div wm-cor */
        div[wm-cor]{
            background-color: darksalmon;
        }

        /* só vai funcionar antes do div:hover */
        div.estilo{ background-color: purple; }

        /* ao passar o mouse irá mostrar a cor */
        div:hover{ background-color: #00b; color: orangered; }

        /*  */
        #unico1, #unico2{background-color:yellow;}

    </style>
</head>
<body>
    <div id = "unicol" class="estilo" style="background-color: red;"><!--esse style irá passar por cima dos outros-->
        #unico1 vs .estilo vs inline
    </div>
    <div id="unico2" class="estilo"> #unico2 vs .estilo</div>
    <div class="estilo" wm-cor>.estilo vs wb-cor</div>
    <div wm-cor>wm-cor</div>
    <div class="estilo">.estilo</div>
    <div>elemento</div>
</body>
</html>


 

Especificidade 1 em HTML

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Especificidade CSS</title>
    <style>
        /* https://developer.mozilla.org/pt-BR/docs/Web/CSS/Specificity */
        /*
            Em linhas gerais...
            1. regra com !important
            2. seletores mais específicos
            3. última regra processada (empate)
        */

        /* definindo a propriedade do paragráfo */
        p {
            background-color: orange;
        }
        /* definindo propriedade da classe observação */
        .observacao{
            background-color: #5f5;
            border: dashed 5px;
            padding: 20px;
            font-size: 40px;
            width: 300px;/*comprimento*/
        }
        
        p.observacao{
            padding: 2px;
            background: linear-gradient(to right, red, yellow);
        }

        
    </style>
</head>

<body>
    <p class='observacao'>Olha essa observação!!!!</p>
</body>

</html>