Forums

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
    Posts
  • #39005

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













    11111



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

    thanks
    ns.

    #107201

    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: http://validator.w3.org/check

    #107202

    Thanks. I will do it.

    #107204

    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):


    11111

    But when I give this way:

    11111

    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?

    #107205

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

    #107206

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

    #107208

    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.

    #107214

    ok. Thanks for your help.

    #107224

    No worries.

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