I have an issue with the reponsive of my website. In desktop mode, I have a div in the center of my screen with a grey background-color. In tablet mode, I would like to let my div and its content centered in the screen, but fill the entire width of the screen with grey. Is it possible?
@media screen and (min-width: 767px) and (max-width: 1366px) {
.backgroundGrey {
background-color: #F2F2F2;
/* please tell me it's possible */
}
}
<body>
<section>
<div class="flexCenter backgroundGrey">
<div>
<h2>Content
<h2>
</div>
</div>
</section>
</body>
EDIT with solution
Thank you all for your answers, I mixed it up and found a solution to my problem. I added a new div with my background-color set in position absolute:
<body>
<section>
<div class="backgroundGreyFullWidth"></div>
<div class="flexCenter">
<div>
<h2>Content</h2>
</div>
</div>
</section>
</body>
@media screen and (min-width: 767px) and (max-width: 1366px) {
.backgroundGreyFullWidth {
background-color: #f2f2f2;
position: absolute;
z-index: -1;
width: 100%;
height: 650px;
left: 0;
right: 0;
}
}