To ensure that a section
uses the whole width of the browser can do so:
section {
float: left;
clear: both;
width: 100%;
height: 200px; // caso queira defenir a altura via CSS e não pela quantidade de conteúdo
}
Starting from the presuposto who is a direct descendant of the body or what his relative has width: 100%;
also, without padding
or margin
.
To ensure that every Section uses full screen height you can use CSS (in modern browsers) with Viewport height:
section {
height:100vh;
}
Or use jQuery:
$('section').css('height', $(window).height() + 'px');
And to ensure that all the space is used you need to reset the margins. At least it would be:
body {
margin: 0px;
padding: 0px;
}
(withdraw the /show/
url to view code)
in the example you gave, the sections are not occupying the space of the browser... I am using Chrome
– Vinícius
@Is that how you want it? http://jsfiddle.net/09xfjswo/1/show/
– Sergio
Got it! The width of the sections are equivalent to that of the browser. And to put the browser height in the sections?
– Vinícius
@Vinicius added to the answer. But it means it wants the height of the window size?
– Sergio
Exactly Sergio! With this code you put in the answer, can you then have an effect similar to the example of the question? Are these best practices? Is there a problem of cross-browsers?
– Vinícius