I have created a Bootstrap 3 card-wide, and set the div class="card-wide-image-wrap" to a min-width of 50%. This ensures correct display on my laptop (otherwise it won't show the full image with overlay text-block). However, a min-width of 50% for the div messes up how the card is displayed on a mobile phone (Images below). Is there a way to fix this?
A second question: for every line of text that is added on the right, the image on the left seems to become enlarged. Can the image somehow be separated from the text side of the card so that it stays fixed?
The image below is the wanted result on a PC/large screen. I get this when I set the div min-width to 50%.
However, as seen in image below, this does not show up well on a mobile phone:
If I omit the div min-width 50%, I get the following unwanted result on PCs/large screens:
However, it then displays correctly on a mobile device:
Here is my code. Thanks Ric:
<style>
p {
color: white;
}
h2.ex1 {
padding-left: 30px;
}
ul.ex1 {
padding-left: 60px;
}
p.ex1 {
padding-left: 30px;
}
h6.ex2{
font-size: 22px;
}
.text-block {
position: absolute;
bottom: 80px;
right:370px;
background-color: #292929;
color: white;
padding-left: 20px;
padding-right: 20px;
block-size: max-content;
}
.cover {
object-fit: cover;
width: 10px;
height: 10px;
}
div img{
min-width:100%;
min-height:100%;
height:auto;
position:relative;
top:50%;
left:50%;
transform:translateY(-50%) translateX(-50%);
}
</style>
<p style="text-align: center;"><br></p><div><div class="col-xs-12">
<div class="calcite-web">
<div class="card-base card-wide" style="background: #292929;max-width: 100%; margin: 0 auto;">
<div class="card-wide-image-wrap" style="min-width:50%">
<img alt="hurricanes" class="card-wide-image cover img-fluid" src="#">
<div class="text-block">
<h6 class="ex2" style="text-align: left; color: rgb(38, 149, 188);">Naturkræfter</h6>
<p style="text-align: left; color: rgb(38, 149, 188);">Cykloner i den nordlige og
sydlige hemisfære, adskilt af ækvator, hvor corioliskraften er 0, og
derfor forhindrer hvirvelvindene i at formes og krydse ækvatorlinjen</p>
</div>
</div>
<div class="card-content px-2">
<h2 class="ex1" style="color: white" id="intro">Lorem Ipsum</h2>
<br>
<p class="ex1">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea</p>
<br>
<ul class="ex1" style="color: white">
<li>Duis aute irure dolor in </li>
<li>Eprehenderit in voluptate velit esse cillum </li>
<li>Dolore eu fugiat nulla pariatur</li>
<li>Excepteur sint occaecat cupidatat non proident</li>
<li>Csunt in culpa qui</li>
</ul>
<br>
<p><a href="#" class="btn btn-primary" style="min-width: 114px; margin-left: 25px"
target="_blank">Send os en besked</a></p>
<br>
</div>
</div>
</div>
</div>
</div>