HTML code for borders

  • Unknown's avatar

    Can anyone explain why the html code for borders

    < div style=”border:1px;width: 200px;” >TEXT HERE< /div >

    doesn’t work in wordpress.com blogs?

    Is it being stripped out for any reason or is my code wrong (highly doubt so)?

  • Unknown's avatar

    Try adding a color descriptor, and maybe increase the thickness of the border a bit. I don’t know about your “width” element. This is what I’ve been using:

    <div style="border:10px solid black;padding:2em;">TEXT HERE</div>

  • Unknown's avatar

    1. sensuouscurmudgeon is right, you need to define a color for the border – either with a standard word or with a hex number.

    2. But if it was only that, you’d simply get an invisible border, not stripping out. If your code is stripped out, you’re probably pasting it with curved instead of straight quotes (compare your example with sensuouscurmudgeon’s).

    3. sensuouscurmudgeon is also right in that normally you need some padding too (space between border and text).

    4. The thickness of the border doesn’t matter. Width is also ok.

  • Unknown's avatar

    I originally got my border code from panaghiotisadam, so I yield to pan’s expertise in every particular.

  • Unknown's avatar

    Ah thanks so much sensuouscurmudgeon and panaghiotisadam! I use the html editor instead of visual editor, so it was pretty clear that after saving draft, the entire code was gone and only the ‘TEXT HERE’ remained.

    I copied sensuouscurmudgeon’s code and changed the variables a little and it worked! Thanks so much again!

  • The topic ‘HTML code for borders’ is closed to new replies.