Currently, I am working on a project that involves displaying images with text overlays. The text overlays are designed as inline blocks with varying background colors.
One issue I encountered is that there is unwanted whitespace between the background colors that needs to be removed. ✔️
Additionally, I need the left inline block to have a fixed width, while the right block should extend to cover the remaining width of the container ✔️
Another requirement is for the second block to reveal an additional element on hover.
Lastly, I aim to ensure that both blocks maintain an equal height even if one block's height changes.
UPDATE The paragraph division should be visible on hover. Also, I want the heights of the inline blocks to remain consistent at all times, regardless of any changes.
This is the code I have developed so far
.slideList {
width: 100%;
}
.slideList li {
position:relative;
}
.slideList .service-highlight {
position: absolute;
color: white;
bottom: 0;
left: 0;
right:0
}
.slideList .service-highlight p {
display: inline-block;
color: white;
font-size: 18px;
font-weight: bold;
}
.slideList .service-highlight .services-box{
text-align: center;
background-color: #003768;
width: 200px;
font-weight: bold;
float: left;
}
.slideList .service-highlight .services-detail{
background-color: #0088ff;
width:calc(100% - 200px);
float: left;
padding-left: 5px;
}
.slideList .hide-description {
display: none;
font-weight:normal;
}
.slideList .hide-description p {
font-weight:normal;
padding-top: 10px 5px 10px;
}
.services-detail:hover + .hide-description {
display: block;
position: absolute;
}
.clearFloat {
clear: both;
}
<ul class="slideList">
<li data-transition="fade">
<img src="https://images.unsplash.com/photo-1532274402911-5a369e4c4bb5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" >
<div class="service-highlight">
<p class="services-box">SOME SERVICE:</p>
<div class="services-detail">
<p>Some headline</p>
<div class="hide-description">
<p>Some text that appears here. Text describes some service I intend to achieve. This may or may not take up to three lines maybe two </p>
</div>
</div>
</div>
</li>
<ul>