I have a Shopify store which has a split page in half with text on one side and an image on the other. I would like the text to be positioned so that it is on the middle of the image vertically. This is the code i am currently using:
<div class="image">
</div>
<div class="textcontainer">
Some text which i would like centred
</div>
.image {
width: 58%;
padding-top: 60%;
margin-right: 2%;
position: relative;
float: left;
position: relative;
background-image: url("https://cdn.shopify.com/s/files/1/0292/7217/8793/files/photo-1556760647-90d218f7ca5b.jpg?v=1589200183");
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
}
.textcontainer {
width: 40%;
position: relative;
float: left;
Has anyone got any idea how i can do this. Many thanks.
3
Answers
I think this should work
wrap your image and text in div
.container
, and set the rules forflex
andalign-item center
.