Home > Software engineering >  Text isn't showing when I add another div
Text isn't showing when I add another div

Time:04-10

I want to show text right side to image and I was successful to made it but when I add another div for border the text doesn't show up, it's like invisible but still taking its space I tried but I can't figure out the problem here you can see the live preview https://jsfiddle.net/Ldu91at2/ And here is the code before adding a main div for border:-

<div  style="display:inline-block; min-width:6.2cm; height:8.8cm; align: center;vertical-align: middle;" >
    
  <img src="https://www.asurascans.com/wp-content/uploads/2020/10/56953.jpg" style="height:100%;">
</div>

<div style="display:inline-block;vertical-align: top;">
  <span id="title">advertishement</span> 
</div>

CodePudding user response:

This is the css style you are using for the .cont div

.cont{
    width:fit-content;
    border: 1px solid #eee;
    padding: 10px;
    color: #fff;
 }

The

color: #fff;

rule makes your text white thus invisible against a white background. Consider removing it or using a different color. The code below will work.

   .cont{
    width:fit-content;
    border: 1px solid #eee;
    padding: 10px;
 }
  • Related