I have been trying to get the following code working for hours, without success... Could you please help me to get the projects div centered (even when the page is zoomed in and out)?
Here is my HTML & CSS:
#bottom {
position: absolute;
top: 100%;
left: 0;
right: 0;
background-color: #FFF;}
#secondsection {
background-size: 100% auto;
background-size: cover;
color: #eaeaf0;
margin-left: 7%;
margin-right: 7%;
padding-top: 35px;
padding-bottom: 35px;
position: relative;}
#ss_top {
width: 100%;
height: 100%;}
.ss_title {
display: inline;
float:left;
color: #000000;
font-family: 'Eurostile';
font-size: 35px;
text-transform: uppercase;}
.ss_title2 {
color: #a5a5a5;}
#gallerybutton {
position: relative;
display: inline;
float: right;
margin-right: 0%;
margin-top: 50px;
padding: 20px;
background-color: #000;
text-decoration: none;
border: none;
color: #FFF;
text-transform: uppercase;}
#projects {
position: relative;
margin-left: auto;
margin-right: auto;
max-width: 2000px;
padding: 175px 0px 0px 0px;}
#pr_one, #pr_two {
display: block;}
.pr_img {
float: left;
display: inline;
margin-right: 1%;
margin-bottom: 1%;}
#viewprofilebutton {
position: relative;
left: -75px;
margin-left: 50%;
margin-top: 3.5%;
margin-bottom: 2.5%;
padding: 20px;
background-color: #000;
text-decoration: none;
border: none;
color: #FFF;
text-transform: uppercase;}
<div id="secondsection">
<div id="ss_top">
<p class="ss_title">A selection of projects<br /><span class="ss_title2">I've worked on lately</span></p>
<button type="button" id="gallerybutton">See everything</button>
</div>
<div id="projects">
<div id="pr_one">
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
</div>
<div id="pr_two">
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
</div>
</div>
<button type="button" id="viewprofilebutton">See my work</button>
</div>
Here is a start. Look at the following CSS:
#bottom {
position: absolute;
top: 100%;
left: 0;
right: 0;
background-color: #FFF;}
#secondsection {
background-size: 100% auto;
background-size: cover;
color: #eaeaf0;
margin-left: 7%;
margin-right: 7%;
padding-top: 35px;
padding-bottom: 35px;
position: relative;
border: 1px dotted red;
}
#ss_top {
width: 100%;
height: 100%;
border: 1px dotted blue;
overflow: auto;
}
#ss_top p {
margin: 0;
}
.ss_title {
display: inline-block;
color: #000000;
font-family: 'Eurostile';
font-size: 35px;
text-transform: uppercase;}
.ss_title2 {
color: #a5a5a5;}
#gallerybutton {
position: relative;
display: inline;
float: right;
margin-right: 0%;
margin-top: 50px;
padding: 20px;
background-color: #000;
text-decoration: none;
border: none;
color: #FFF;
text-transform: uppercase;}
#projects {
position: relative;
margin-left: auto;
margin-right: auto;
max-width: 2000px;
padding: 175px 0px 0px 0px;
border: 1px dashed blue;
}
#pr_one, #pr_two {
display: block;
border: 2px dashed blue;
overflow: auto;
text-align: center;
}
.pr_img {
display: inline-block;
width: 30%;
margin-right: 1%;
margin-bottom: 1%;
}
.pr_img img {
display: inline-block;
width: 100%;
height: auto;
}
#viewprofilebutton {
position: relative;
left: -75px;
margin-left: 50%;
margin-top: 3.5%;
margin-bottom: 2.5%;
padding: 20px;
background-color: #000;
text-decoration: none;
border: none;
color: #FFF;
text-transform: uppercase;}
I started by getting rid of the floats in the title, #ss_top, you don't need it.
For the #projects panel with the images, floats are getting you into trouble with
centering.
On #pr_one and #pr_two, add text-align: center and then use display: inline-block on .pr_img, this will center align your images (give/take some margins), and then apply a suitable width of say 30% so that the images auto scale to form a row of three.
The trick now is to apply display: inline-block to the images (.pr_img img) so you
can now use margins to control top/bottom/left/right spacing.
See demo at: http://jsfiddle.net/audetwebdesign/rmtpy6t0/
Note: You still have some polishing up to do but at least this clarifies the issues related to centering and floated elements.
Responsive Design: If you want 2 or 3 images in a row depending on the screen size, you need to learn about media queries. However, because you wrapped 3 images in a div, you are locked into 3 per row, but that may be okay.
If you want to center your pictures, make changes in your css:
.pr_img {
/* float: left; */
display: block;
/* margin-right: 1%; */
/* margin-bottom: 1%; */
margin: 0 auto;
}
Instead of using margin-left:auto and margin-right:auto add margin:auto
#projects {
position: relative;
margin:auto;
max-width: 2000px;
padding: 175px 0px 0px 0px;
}
.pr_img {
display: block;
margin: 0 auto;
}
tell me if it works
edit: yep.
works :)
http://jsfiddle.net/max7j84m/
.pr_img {
text-align: center;
left: 0;
right: 0;
display: block;
margin: 0 auto;
}
It's work for me
Related
I want to position the text on top of the image, but with 40px margin. I also want to position the two buttons on each side of the li (one on the right side and one on the left side). I've tried with the code below, and various other solution, but with no luck. The closest I've come is what the picture below shows, but the buttons are not in position. I want to have the same layout for every li, so I want this to apply to every li on the page.
CSS:
.container {
width: 100%;
}
.posts {
position: absolute;
top: 200px;
bottom: 0;
right: 30px;
margin: 0;
}
.post {
background-color: #606060;
border-radius: 30px;
width: 600px;
min-height: 300px;
float: right;
margin-bottom: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
bottom: auto;
top: auto;
}
.img {
background-color: #606060;
background-repeat: no-repeat;
background-size: contain;
width: 90%;
height: 300px;
position: relative;
margin-bottom: 100px;
border-radius: 50px;
}
.content {
font-size: 15px;
text-align: left;
min-height: 120px;
position: relative;
left: 10px;
color: white;
font-weight: 700;
margin-top: 40px;
}
.comment {
background-color: #006FC4;
border: 1px solid #00508D;
font-size: 15px;
color: #FFFFFF;
padding: 5px;
border-radius: 7px;
height: 30px;
position: absolute;
bottom: 0;
float: left;
}
.like {
background-color: #006FC4;
border: 1px solid #00508D;
font-size: 15px;
color: #FFFFFF;
padding: 5px;
border-radius: 7px;
height: 30px;
position: absolute;
float: right;
}
HTML:
<div class="container">
<ul class="posts">
<li class="post">
<div class="content">Test</div>
<button class="comment" onclick="comment('posts/XiqNjxsov3hUXX1zJLk3ta7mQul2/userPosts/PkIm2NOhjOlTZk7J7Dyk')">Comment</button>
<button class="like" onclick="like('posts/XiqNjxsov3hUXX1zJLk3ta7mQul2/userPosts/PkIm2NOhjOlTZk7J7Dyk')">Like</button><img class="img" src="https://firebasestorage.googleapis.com/v0/b/mysharify-4ea69.appspot.com/o/posts%2F6.png?alt=media&token=f1881e5e-e9f4-4e90-bf0f-f211a74ccd42" onclick="openImage('https://firebasestorage.googleapis.com/v0/b/mysharify-4ea69.appspot.com/o/posts%2F6.png?alt=media&token=f1881e5e-e9f4-4e90-bf0f-f211a74ccd42')"></li><br><br>
<li class="post">
<div class="content">dasdasd</div>
<button class="comment" onclick="comment('posts/hg23gh1beGO7cpUvRSkKpqcY9O22/userPosts/TpiuWCRoZQliuhmlj1su')">Comment</button>
<button class="like" onclick="like('posts/hg23gh1beGO7cpUvRSkKpqcY9O22/userPosts/TpiuWCRoZQliuhmlj1su')">Like</button></li><br><br>
</ul>
</div>
I'm not entirely sure what you're going for based on your post (would be helpful to have a link to something similar to what you're trying to get), but here's my best guess.
HTML (I removed the second LI, since they'll all look the same anyways and that one didn't have an image)
<div class="container">
<ul class="posts">
<li class="post">
<div class="content">Test</div>
<button
class="comment"
onclick="comment('posts/XiqNjxsov3hUXX1zJLk3ta7mQul2/userPosts/PkIm2NOhjOlTZk7J7Dyk')"
>
Comment
</button>
<button
class="like"
onclick="like('posts/XiqNjxsov3hUXX1zJLk3ta7mQul2/userPosts/PkIm2NOhjOlTZk7J7Dyk')"
>
Like
</button>
<img
alt="foo"
class="img"
src="https://firebasestorage.googleapis.com/v0/b/mysharify-4ea69.appspot.com/o/posts%2F6.png?alt=media&token=f1881e5e-e9f4-4e90-bf0f-f211a74ccd42"
onclick="openImage('https://firebasestorage.googleapis.com/v0/b/mysharify-4ea69.appspot.com/o/posts%2F6.png?alt=media&token=f1881e5e-e9f4-4e90-bf0f-f211a74ccd42')"
/>
</li>
</ul>
</div>
CSS
.container {
width: 100%;
}
.posts {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
list-style: none;
}
.post {
background-color: #606060;
border-radius: 30px;
width: 100%;
float: right;
position: relative;
margin: 1rem 0;
}
.img {
position: relative;
background-color: #606060;
background-repeat: no-repeat;
background-size: contain;
width: 100%;
border-radius: 50px;
}
.content {
font-size: 15px;
position: absolute;
z-index: 10;
color: white;
font-weight: 700;
margin: 40px;
}
.comment {
background-color: #006fc4;
border: 1px solid #00508d;
font-size: 15px;
color: #ffffff;
padding: 5px;
border-radius: 7px;
position: absolute;
bottom: 0;
left: 0;
z-index: 10;
}
.like {
background-color: #006fc4;
border: 1px solid #00508d;
font-size: 15px;
color: #ffffff;
padding: 5px;
border-radius: 7px;
position: absolute;
bottom: 0;
right: 0;
z-index: 10;
}
In This Code,I want to set the margin-top of .Login class ,smaller,although I set The margin-top ,to zero,but it is not set near to the top of page.What Can I do?why by setting the margin-top of this division ,this div does not set ,near the top of page?is other thing ok?the other elements works properly.
body {
margin: 0px;
direction: rtl;
}
#font-face {
src: url('../fonts/IRANSansWeb.eot'), url('../fonts/IRANSansWeb.woff'), url('../fonts/IRANSansWeb.woff2'), url('../fonts/IRANSansWeb.ttf');
font-family: "IranSans";
}
header {
width: 100%;
min-height: 700px;
height: auto;
overflow: auto;
background-color: #007bff;
}
nav {
margin-top: 0px;
height: 50px;
}
nav ul {
width: 60%;
height: 60px;
margin: 0px auto;
border: 2px solid black;
display: inline-block;
}
.Logo {
width: 160px;
height: 50px;
margin-left: 0px;
margin-right: 30px;
margin-bottom: 0px;
display: inline-block;
}
.Logo img {
width: 100%;
height: 100%;
}
.LogIn {
width: 140px;
height: 50px;
display: inline-block;
margin-right: 130px;
margin-top: 0px;
font-family: "IranSans";
border-radius: 5px;
background-color: #00d363;
}
.LogInA {
width: 100%;
height: 100%;
border: 5px;
color: #fff;
display: inline-block;
text-decoration: none;
text-align: center;
line-height: 50px;
}
.LogInA:hover {
border-radius: 5px;
background-color: #007bff;
color: #00d363;
border: 1px solid #00d363;
}
<body>
<header>
<nav>
<div class="Logo"><img src="Content/img/logo.png" alt="جاب بورد"></div>
<ul>
</ul>
<div class="LogIn">
<a class="LogInA" href="#">ارسال شغل</a>
</div>
</nav>
</header>
</body>
Try adding display: flex; to your nav
You should use:
display:flex; justify-content: center; to your Nav and also you should remove height and use: flex-direction:column; in mobile version.
I have a navigation at the bottom of a page. Everything works fine and how I want it to except for one small bug and I can't seem to work out a solution...
When the page name is long and you view it on an iPad size screen, the name goes onto two lines - which is fine - how ever I would like the adjacent button to match the height (so they both stay the same height) and to both stay horizontally aligned to the centre.
Ive tried a few different things like display table and table cell, flex etc. but I can't seem to work out a solution that works properly.
Any suggestions on how I can do this...?
.footerNav-wrapper {
width: 100%;
background-color: #000;
padding: 35px 0;
z-index: 9000;
position: relative;
}
.footerNav {
width: 90%;
max-width: 1000px;
margin: 0 auto;
}
.navArrow-left {
float: left;
margin: 0;
position: absolute;
top: 30%;
left: 10px
}
.navArrow-right {
float: right;
margin: 0;
position: absolute;
top: 30%;
right: 10px;
}
.footerNav a {
width: 49%;
font-family: 'ABCSans-Regular', Arial, sans-serif;
border: 1px solid #fff;
background-color: #000;
color:#ffc600;
margin: 0;
text-align: center;
font-size: 14px;
line-height: 18px;
letter-spacing: 0px;
cursor: pointer;
-webkit-transition: all .5s;
transition: all .5s;
text-decoration: none;
box-sizing: border-box;
position: relative;
}
.footerNav a:hover {
border: 1px solid #ffc600;
background-color: #ffc600;
color: #000;
text-decoration: none;
}
.left {
float: left;
text-align: left !important;
padding: 15px 15px 12px 45px;
}
.right {
float: right;
text-align: right !important;
padding: 15px 45px 12px 15px;
}
<div class="footerNav-wrapper">
<nav class="footerNav">
<a href="#" class="left">
<img src="images/arrow-left-white.png" class="navArrow-left" alt="Previous page">
PREVIOUS PAGE NAME
</a>
<a href="c#" class="right">
NEXT PAGE NAME - THIS IS AN EXTRA LONG NAME
<img src="images/arrow-right-white.png" class="navArrow-right" alt="Next page">
</a>
<div style="clear:both;"></div>
</nav>
</div>
i used display:flex; on .footerNav and added margin to classes left and right.
.footerNav-wrapper {
width: 100%;
background-color: #000;
padding: 35px 0;
z-index: 9000;
position: relative;
}
.footerNav {
width: 90%;
max-width: 1000px;
margin: 0 auto;
display:flex;
}
.navArrow-left {
float: left;
margin: 0;
position: absolute;
top: 30%;
left: 10px
}
.navArrow-right {
float: right;
margin: 0;
position: absolute;
top: 30%;
right: 10px;
}
.footerNav a {
width: 49%;
font-family: 'ABCSans-Regular', Arial, sans-serif;
border: 1px solid #fff;
background-color: #000;
color:#ffc600;
text-align: center;
font-size: 14px;
line-height: 18px;
letter-spacing: 0px;
cursor: pointer;
-webkit-transition: all .5s;
transition: all .5s;
text-decoration: none;
box-sizing: border-box;
position: relative;
}
.footerNav a:hover {
border: 1px solid #ffc600;
background-color: #ffc600;
color: #000;
text-decoration: none;
}
.left {
float: left;
text-align: left !important;
padding: 15px 15px 12px 45px;
margin-right: 1%;
}
.right {
float: right;
text-align: right !important;
padding: 15px 45px 12px 15px;
margin-left: 1%;
}
<div class="footerNav-wrapper">
<nav class="footerNav">
<a href="#" class="left">
<img src="images/arrow-left-white.png" class="navArrow-left" alt="Previous page">
PREVIOUS PAGE NAME
</a>
<a href="c#" class="right">
NEXT PAGE NAME - THIS IS AN EXTRA LONG NAME
<img src="images/arrow-right-white.png" class="navArrow-right" alt="Next page">
</a>
<div style="clear:both;"></div>
</nav>
</div>
You can also use display: table; and display: table-cell; to do that if you need to support really old browsers (http://caniuse.com/#search=flex). However i would recomment using flexbox as GvM pointed out.
There is an interesting article about serveral ways to do what you want to do: https://css-tricks.com/fluid-width-equal-height-columns/
.footerNav-wrapper {
width: 100%;
background-color: #000;
padding: 35px 0;
z-index: 9000;
position: relative;
}
.footerNav {
display: table;
width: 90%;
max-width: 1000px;
margin: 0 auto;
}
.navArrow-left {
float: left;
margin: 0;
position: absolute;
top: 30%;
left: 10px
}
.navArrow-right {
float: right;
margin: 0;
position: absolute;
top: 30%;
right: 10px;
}
.footerNav a {
width: 49%;
font-family: 'ABCSans-Regular', Arial, sans-serif;
border: 1px solid #fff;
background-color: #000;
color:#ffc600;
margin: 0;
text-align: center;
font-size: 14px;
line-height: 18px;
letter-spacing: 0px;
cursor: pointer;
-webkit-transition: all .5s;
transition: all .5s;
text-decoration: none;
box-sizing: border-box;
position: relative;
}
.footerNav a:hover {
border: 1px solid #ffc600;
background-color: #ffc600;
color: #000;
text-decoration: none;
}
.left {
display: table-cell;
text-align: left !important;
padding: 15px 15px 12px 45px;
}
.right {
display: table-cell;
text-align: right !important;
padding: 15px 45px 12px 15px;
}
<div class="footerNav-wrapper">
<nav class="footerNav">
<a href="#" class="left">
<img src="images/arrow-left-white.png" class="navArrow-left" alt="Previous page">
PREVIOUS PAGE NAME
</a>
<div style="display: table-cell; width: 2%;"></div>
<a href="c#" class="right">
NEXT PAGE NAME - THIS IS AN EXTRA LONG NAME
<img src="images/arrow-right-white.png" class="navArrow-right" alt="Next page">
</a>
</nav>
</div>
yesterday I posted a question asking how can I center a div inside a div... Now I have another problem, I want to center a div on the screen. I want it to be in the middle and to take up 50% of the screen;
Here is a pic of the problem:
As you can see there isn't anything in the middle of the screen, that is my problem. Here is my HTML code:
* {
font-size: 100%;
font-family: Serif;
}
body {
background: url("images/background.jpg") repeat;
font-size: 100%;
}
.items {
background-color: rgba(0,0,0,.5);
width: 100%;
text-align: center;
margin: 0;
}
#basicInfo{
background-color: rgba(255,150,0,.8);
width: 100px;
height: 100px;
display: inline-block;
margin-top: 10px;
margin-bottom: 10px;
}
#basicInfo:hover{
background-color: rgba(255,150,0,1);
}
#basicInfo img{
display: block;
margin-left: auto;
margin-right: auto;
padding-top: 16px;
}
#langs{
background-color: rgba(255,150,0,.8);
width: 100px;
height: 100px;
display: inline-block;
margin-top: 10px;
margin-bottom: 10px;
}
#langs img{
display: block;
margin-left: auto;
margin-right: auto;
padding-top: 16px;
}
#langs:hover{
background-color: rgba(255,150,0,1);
}
.navbar {
background-color: rgba(0,0,0,0.1);
position: fixed;
bottom: 0px;
left: 0px;
right: 0px;
width: 100%;
min-height: 5%;
}
.button{
background-color: rgba(0,0,0,.5);
font-size: 2em;
color: white;
width: 33%;
margin: 0 .16%;
height: 100%;
float: left;
}
.button:hover{
background-color: rgba(0,0,0,.7);
}
.button a{
text-decoration: none;
display: block;
color: white;
text-align: center;
vertical-align: middle;
}
#textSpace {
background-color: rgba(0,0,0, .5);
width: 100%;
height: 50%;
display: block;
top: auto;
bottom: auto;
}
<title>Mateo's About Page</title>
</head>
<body>
<div class="items">
<div id="basicInfo">
<img src="images/question.png">
</div>
<div id="langs">
<img src="images/code.jpg">
</div>
</div>
<div id="textSpace">
</div>
<div class="navbar">
<div class="button">
<b>Mateo</b>
</div>
<div class="button">
<b>Home</b>
</div>
<div class="button">
<b>Josh</b>
</div>
</div>
Any help is apriciated! Thanks in advance!
To horizontally centre a div in the middle of the screen use:
margin-left:auto;
margin-right:auto;
I can't figure out why my elements (logo, menu, info box) are outside the light grey container. Could you help me? Many thanks
See: http://jsfiddle.net/vqoudo6d/3/
HTML:
<header class="header">
<div class="header-wrapper">
<img class="header-logo" src="http://lorempixel.com/output/fashion-q-g-284-119-5.jpg">
<nav class="header_nav">
<ul class="header_nav-wrapper">
<li class="header_nav-item"> <a id="aboutOpen" class="header_nav-item-a" href="jkk">l'Atelier</a>
</li>
<li class="header_nav-item"> <a class="header_nav-item-a header_nav-item-a--btn" href="jkjks" target="_blank">La Carte des soins</a>
</li>
<li class="header_nav-item"> <a class="header_nav-item-a header_nav-item-a--btn" href="jkjks" target="_blank">Contact</a>
</li>
</ul>
</nav>
</div>
<div class="infos-pratiques clearfix">
<p class="info-pratiques-tag">Informations pratiques</p>
<div class="info-pratiques-content">
<p>3 rue dfdsf
<br>sdsqdssdd</p>
<p>Lundi:
<br>Mardi:
<br>Mercredi:
<br>Jeudi</p>
</div>
</div>
</header>
<div class="slider">
<ul class="slider__wrapper">
<li class="slider__item">
<div class="box" style="background-image:url(images/test.jpg);background-size: cover;
background-repeat: no-repeat; background-position: 50% 50%;"></div>
</li>
<li class="slider__item">
<div class="box" style="background-image:url(images/test2.jpg);background-size: cover;
background-repeat: no-repeat; background-position: 50% 50%;"></div>
</li>
</ul>
</div>
CSS:
.slider {
position: relative;
margin-left: auto;
margin-right: auto;
width: 90%;
height: 550px;
background: #eee;
overflow: hidden;
box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
max-width: 1200px;
}
.slider__wrapper {
height: 100%;
list-style: none;
overflow: hidden;
*zoom: 1;
-webkit-backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
}
.slider__item {
height: 100%;
float: left;
clear: none;
}
.slider__arrows-item {
position: absolute;
display: block;
margin-bottom: -20px;
padding: 20px;
}
.slider__arrows-item--right {
bottom: 50%;
right: 30px;
}
.slider__arrows-item--left {
bottom: 50%;
left: 30px;
}
.slider__nav {
position: absolute;
bottom: 30px;
}
.slider__nav-item {
width: 12px;
height: 12px;
float: left;
clear: none;
display: block;
margin: 0 5px;
background: #fff;
}
.slider__nav-item--current {
background: #ccc;
}
.slider__nav-item:hover {
background: #ccc;
}
.box {
width: 100%;
height: 100%;
}
.header {
z-index: 999;
width: 100%;
margin-left: auto;
margin-right: auto;
position: absolute;
}
.header-wrapper {
padding: 54px 60px;
}
.header-logo {
float: left;
clear: none;
}
.header_nav {
float: right;
clear: none;
font-family:'Maven Pro', sans-serif;
font-weight: normal;
}
.header_nav-wrapper {
list-style: none;
}
.header_nav-item {
margin-left: 22px;
float: left;
clear: none;
}
.header_nav-item-a {
color: #474032;
text-decoration: none;
}
.header_nav-item-a:hover {
color: #eee;
}
.header_nav-item-a--btn {
padding: 16px 18px;
border-radius: 5px;
border: 1px solid #474032;
background-color: transparent;
}
.header_nav-item-a--donate {
margin-top: -18px;
}
.header_nav-item-a--btn:hover {
border: 1px solid #eee;
}
.info-pratiques-content {
float: left;
clear: both;
margin-top: 14px;
margin-left: 4.52489%;
font-size: 13px;
line-height: 1.38;
color: #433d2b;
}
.info-pratiques-content p {
margin-bottom: 1em;
}
.info-pratiques-tag {
margin-top: 14px;
margin-right: auto;
margin-left: auto;
padding-top: 2px;
padding-right: 2px;
padding-bottom: 2px;
padding-left: 2px;
background-color: #9d926a;
font-size: 13px;
font-weight: 400;
line-height: 1.38;
text-align: center;
text-transform: uppercase;
color: rgb(65, 61, 45);
}
.infos-pratiques {
position: absolute;
top: 217px;
right: 5.1984375%;
z-index: 26;
width: 221px;
height: 200px;
background-color: rgb(222, 222, 222);
opacity: 0.91;
}
The max-width and the background are on .slider, but your header is not inside of it. just add the background and max-width to body and everything should be fine.
Also keep in mind that absolutely positioned elements are always relative to the closest non-static element (position: fixed, relative, absolute).
edit: I also agree with Paulie_D's comment, try to reduce absolute positioning