I have a layout with an image on the left or right with the text next to it on the opposite side that when it stacks on mobile the text is always on the top.
For some reason unless the page is in Quirks mode the images don't touch each in the corners even though they should. The DIV ends up slightly taller than the image and I can't figure out why this is.
.site-feature-container {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
flex-flow: row;
text-align: center;
background: #FFFFFF;
}
.site-feature-image-section {
width: 50%;
}
@media only screen and (max-width: 900px) {
.site-feature-image-section {
width: 100%;
}
}
.site-feature-info-section {
width: 50%;
}
@media only screen and (max-width: 900px) {
.site-feature-info-section{
width: 100%;
}
}
.dmwp-work-content:nth-child(even){
flex-direction: row-reverse;
}
.site-feature-container:nth-child(even){
flex-direction: row-reverse;
}
@media only screen and (max-width: 900px) {
.site-feature-container {
flex-direction: column-reverse !important;
}
}
.site-feature-image {
width: 100%;
max-width: 100%;
}
.site-feature-description {
width: 90%;
max-width: 90%;
margin-top: 15px;
margin-bottom: 15px;
margin-left: auto;
margin-right: auto;
}
<!DOCTYPE html>
<head>
<title>Layout</title>
</head>
<body>
<div class="site-feature-container">
<div class="site-feature-image-section">
<div class="site-feature-image">
<img class="site-feature-image" src="https://via.placeholder.com/1920x1080" alt="">
</div>
</div>
<div class="site-feature-info-section">
<div class="site-feature-description">
<p>TITLE</p>
<p>DESC</p>
</div>
</div>
</div>
<div class="site-feature-container">
<div class="site-feature-image-section">
<div class="site-feature-image">
<img class="site-feature-image" src="https://via.placeholder.com/1920x1080" alt="">
</div>
</div>
<div class="site-feature-info-section">
<div class="site-feature-description">
<p>TITLE</p>
<p>DESC</p>
</div>
</div>
</div>
</body>
It seems like it should be a relatively easy fix but I'm not too sure what exactly in the CSS is causing it, removing the Doctype declaration fixes it but obviously the page needs that.
Any help would be appreciated. Thanks in advance.