2

Need to hide text behind a <br>..

Here is what is there in the HTML & CSS: JsFiddle of the issue

Yes, the <br> tag does not have anything in and does not hold content

  • Why not just wrap the text in a `` and put a class or ID on the span? – vcsjones Aug 06 '12 at 18:32
  • 2
    A `
    ` tag cannot contain any content. It's a simple break and that's all.
    – j08691 Aug 06 '12 at 18:32
  • 2
    `
    ` should be `
    ` as it is an opening and closing tag all in one, therefore as someone else mentioned it cannot contain anything.
    – Jon Taylor Aug 06 '12 at 18:33
  • The content is being generated via libraries and to hard to change – Jeremiah Bagula Aug 06 '12 at 18:34
  • text nodes cannot be styled via css. you'll have to wrap the text in a span or other tag and hide that new node. – Marc B Aug 06 '12 at 18:34
  • 1
    @JonTaylor That's XHTML. It's [perfectly fine](http://stackoverflow.com/a/1946446/492405) for plain HTML. In fact, [for HTML5 it can be wrong](http://stackoverflow.com/a/3558200/492405). – vcsjones Aug 06 '12 at 18:35
  • @MarcB could you not style all text on the page to be hidden then make sure you set an explicit style on all other tags to make it visible again? This would technically allow you to style text that isnt in a tag. – Jon Taylor Aug 06 '12 at 18:36
  • @jon: that'd be highly painful, especially if there's other hidden/visible text elsewhere on the page. it'd be a highly ugly game of whack-a-mole. – Marc B Aug 06 '12 at 18:36
  • @MarcB yeah I agree, just throwing it out there that technically it would be possible. – Jon Taylor Aug 06 '12 at 18:38
  • You could change the page content with Javascript, looking for the text between the
    tags. I don't see where it's possible with straight CSS.
    – Tony Aug 06 '12 at 18:40

3 Answers3

2

You can use jQuery to grab the node at runtime and wrap it in a hidden span. http://jsfiddle.net/XrPuU/2

Not extremely flexible or dynamic, but if you can't control the output to begin with your options are pretty limited.

Jimmy Bosse
  • 1,344
  • 1
  • 12
  • 24
0

Why not just wrap with a div and make a class that has the visibility: hidden attribute?

.noshow { visibility: hidden;}

<div class="noshow">Some text to hide</div>
Steve
  • 399
  • 2
  • 7
0

try with :after pseudo selector http://www.w3schools.com/cssref/sel_after.asp

Lukas
  • 7,384
  • 20
  • 72
  • 127
  • That selector, I do not think it means what you think it means. – Ryan Kinal Aug 06 '12 at 18:41
  • this won't work with dynamic content since he'd have to 'dynamically' create the class with the content: being populated with what he wants to hide. – Steve Aug 06 '12 at 18:44