Forums

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

Home Forums CSS Border around paragraph text

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #33050
    NioN
    Member

    How can I get a border around my paragraph text which is nested inside a div with a fixed height and width?

    It works with the text-decoration: underline overline property but I want to give the border some more padding. Increasing the line-height doesn’t work.

    This is the HTML




    TOPAANBOD Ervaren model (750 jr.).

    Staat graag in de picture! Fotoshoot?




    And the CSS


    #advert1text{
    float: left;
    width: 315px;
    height: 94px;
    margin-bottom: 22px;
    background: url('../images/advertbg.jpg') no-repeat;
    }

    #advert1text p{
    padding: 18px 0px 0px 10px;
    line-height: 30px;
    text-decoration: underline overline;
    }

    Thanks in advance.

    #73705
    TheDoc
    Member

    Why don’t you give it a proper border?

    #advert1text p { border: 1px solid #000; }

    #73706
    NioN
    Member

    Already tried that but that places a border around the div and not the paragraph text.

    #73707
    TheDoc
    Member

    It shouldn’t. It is probably only appearing that way because of the padding that you have applied to the paragraph.

    #73708
    NioN
    Member

    I’ve removed the padding and I get the same result; a border around the entire div and not the paragraph.

    It’s weird as removing the div results in a border that takes as much space as possible and does’t stick to the size of the paragraph.

    #73710
    TheDoc
    Member

    Aaahhh yes. Add a margin to the paragraph.

    #73712
    chrisburton
    Participant

    Try this

    #73669
    NioN
    Member

    Unfortunately none of the suggestions worked so far. This is the result I get:

    Result

    And this is how it should be:

    Goal

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