The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS pre tag

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #39005

    There is a table inside a paragraph. The cell inside the table has extra new line. Below is relevant part of the code.


    Now when I remove the pre tag from outer most para, the new lines is not seen. Any ideas why this is happening?



    I would suggest running that through a validator, as there are quite a few problems with that, the biggest of which is wrapping a bunch of block level element with a paragraph. Here is a good validator:


    Thanks. I will do it.


    I have total-validator installed as a plugin in firefox. I validated with that and changed the HTML. instead of pre tag, I used “white-space: pre” as a style for para and it looked good. Thank for the tip @joshuanhibbert.

    I have a question:
    when i give a new line after the para tag, the browser adds small amount of horizontal space after the text (may be couple of pixels):


    But when I give this way:


    There is no space after the text. Does HTML code spacing(new line) also has effect on how the HTML will look in the browsers?


    It does if you are rendering elements as inline, but shouldn’t if you are rendering them as block level.


    What do you mean by this? Should I use paragraphs as inline ?


    Paragraphs are block level by default, and therefore shouldn’t render white space. If they are, then there must be some overriding styles somewhere causing that.


    ok. Thanks for your help.


    No worries.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.