2
I want to place an image inside a div that occupies an entire body, that when you enlarge the screen with the mouse scroll, it continues following the size of the entire screen. Example of site with background like this: http://www.tecmundo.com.br/ When you increase the screen with the mouse scroll, the blue background follows the size of the screen. I believe it is inside the same div, with the exact size, but follow the body with the width. I’ve tried inside the div: width:max-body;
width: 1000%; ( It was the worst of all, had to put all the dice to the left and according to the screen roll with the mouse, one hour did not give.)
Who can help, thank you. Simple doubt, however, is important, because I can access the body something inside the div and etc. If you can do it with javascript, it also serves. HTML, CSS or Javascript. Thank you
<style>
body {
margin: auto;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
div#cabecario {
min-height:1780px;
width: 1000px;
position:relative;
}
div#fundo {
background-color:#C0C0C0;
text-align: center;
background-image: url("../imagem/logo1.jpg");
background-size: 100%100%;
background-repeat: no-repeat;
height: 15%;
width: 100%;
background-color: black;
position: absolute;
top:3%;
}
</style>
<html>
<body>
//Aqui não tem nada
<div id="cabecario">
//Aqui também não tem nada
<div id="fundo">
//Aqui é somente para deixar a imagem no início do cabeçário, que começa no top 0%.
</div>
// Aqui vem as outras informações, como aside, p, textos, imagens, etc
</div>
//Aqui fecha o cabeçário
</body>
//Fechou o body
</html>
Currently, my code is like this. I used some codes that answered below, but did not fix. Thanks to those who help
What part are you talking about? It would be better [Dit] the question and for an example of what you tried to do and what is not working, it is easier to understand. If it’s just the header, it’s only by a width: 100% in the div. And if it doesn’t work, it’s because there’s something wrong with the CSS nesting, not with the DIV itself. Don’t forget to reset the body/html margin and padding
– Bacco