So heres the image of my problem. I have two SVG files, and i want them to sticky to the bottom no matter how i resize my window, and if I resize it to a mobile configuration i want them to stack on top of eachoother
This is my CSS, but after i resize they dont stay even on the bottom. I have the background split with two different colors
* {
box-sizing: border-box;
margin: 0;
padding: 0;
text-decoration: none;
}
.column1 {
height: 100vh;
background-color: #679289;
}
.column2 {
height: 100vh;
background-color: #f4c095;
}
.svg1 {
overflow: visible;
transform: translate(0px, 68px);
}
.svg1 {
overflow: visible;
transform: translate(0px, 166px);
}
Also noting the SVGs are not the same size
CodePudding user response:
Try containing the elements in divs and using flex-box. You might have to adjust it for other layout elements, but the principle should be the same.
https://codepen.io/jonshipman/pen/zYRoKjX
<div >
<div>
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/410.svg" />
</div>
<div>
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/410.svg" />
</div>
</div>
.flex {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: flex-end;
justify-content: center;
background: transparent;
}
.flex > div {
flex: 1 0 auto;
}
img {
width: 5rem;
height: 5rem;
display: block;
margin: 0 auto;
}
div {
background: blue;
}
div:nth-child(2) {
background: yellow;
}
@media screen and (max-width:786px) {
.flex {
flex-direction:column;
align-items:center;
}
.flex > div {
display:flex;
align-items:flex-end;
}
}