Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
How can I hide text content but not child elements?

I am working with an html feed that gives me the following structure

<div class="a">
    <span class="b">Some Text</span>
    Some other, redundant text
</div>

I can't change the structure of the html feed, but I was wondering if there is a CSS solution that will hide the redundant text, so that it takes up zero space, while still keeping the <span> element visible.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

div > span {
  visibility: visible; 
}

div {
  visibility: hidden;
}
<div class="a">
    <span class="b">Some Text</span>
    Some other, redundant text
</div>

about 4 years ago · Juan Pablo Isaza Report

0

A bit hacky but works

.a {
  font-size: 0px;
}
.a span {
  font-size: 1rem;
}

don't use visibility property, it makes the text invisible but does not remove it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!