dahlsdata-tahira dahlsdata-tahira - 5 months ago 9
CSS Question

How to hide element in a div except one?

I have this HTML-code and I would like to hide the text "Cloudy, Wind : 2.4 km/h, Humidity : 100%"

<div class="flxvrJtnbd theDayInfos">
Cloudy<br>
Wind : 2.4 km/h<br>
Humidity : 100%<br>
<span class="dhpflXvrjt degrees coldDegrees">
19°C
</span>
</div>


I just need to show the degrees.

I have tried it with something like:

.theDayInfos:not(.degrees){
display: none;
}


This did'nt work. Are there other ways do achieve this?

Thanks for your help!

Answer

You can use font-size

.flxvrJtnbd.theDayInfos {
  font-size:0rem;/*very  old browsers won't take it */
  }
.dhpflXvrjt.degrees.coldDegrees {
  font-size:1rem;/*very  old browsers won't take it */
}
<div class="flxvrJtnbd theDayInfos">
    Cloudy<br>
    Wind : 2.4 km/h<br>
    Humidity : 100%<br>
    <span class="dhpflXvrjt degrees coldDegrees">
        19°C                                
    </span>
</div>

Comments