2
I’m trying to create a fully responsive layout**, and I have problems with the end of the div border. I purposely put a red border around the div, in case something goes wrong I identify immediately. The goal is that I have all the content of the page displayed on the device (whatever it is), without the scrollbar, but displaying 100 of its content (no real need for scrolling). The two end edges (right and bottom corner) are disappearing from the device screen. Follow the code used
html,
body {
margin: 0;
height: 100%;
}
.um {
background: #333;
color: white;
padding: 50px 20px;
height: 100%;
/* para falta de suporte */
height: -webkit-calc(100% - 100px);
/* para Chrome */
height: -moz-calc(100% - 100px);
/* para Firefox */
height: calc(100% - 100px);
/* para suporte nativo */
}
#containerGeral {
position: relative;
width: 100%;
height: 100%;
border-style: solid;
border-color: red;
background-color: yellow;
}
#caixaTeste {
width: 15%;
height: 15%;
background-color: blue;
position: absolute;
top: 0%;
}
#caixaTeste2 {
width: 15%;
height: 15%;
background-color: green;
position: absolute;
right: 0%;
top: 0%;
}
#containerTeste {
width: 40%;
height: 40%;
border-style: solid;
border-color: red;
background-color: green;
bottom: 30%;
position: absolute;
}
#containerFilho {
position: absolute;
right: 0%;
width: 65%;
height: 65%;
background-color: #ccc;
}
#containerFilho2 {
position: absolute;
right: 0%;
width: 65%;
height: 65%;
background-color: blue;
bottom: 0%;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no">
</head>
<body>
<div>
<h1 align="center">RELATIVO: CONTAINER GERAL</h1>
<div id="caixaTeste">ABSOLUTO</div>
<div id="caixaTeste2">ABSOLUTO</div>
<div id="containerTeste">NOVO CONTAINER
<div id="containerFilho">CONTEINER FILHO
<div id="containerFilho2">CONTAINER FILHO - FILHO</div>
</div>
</div>
</div>
</body>
</html>
** I don’t believe there’s anything 100% responsive.
When I use... height: Calc(100% - 100px); width: Calc(100% - 100px); , there is a blank space. When I use only... height: Calc(100% - 100px); in the div everything, it is the perfect side, appearing the red band I put there. Only the bottom part is missing, where the red border does not appear, the screen is almost perfect. I’m still curious. But it really helps me!
– Paulo Sérgio Duff
I don’t understand what’s going on, what element are you putting these rules on ? I made an edition with an example of your code...@Paulosérgioduff something comments that agent adjusts
– MagicHat