Span background colour only around text?

Discussion in 'HTML & Website Design' started by Josh-H, Jun 23, 2012.

  1. #1
    Hey guys,

    Struggling to code this, I thought it would be really easy but it's turning out to be a pain.

    I'm trying to having a block of white background behind the text in my header image, but if it wraps down to the second line then it creates all sorts of problems!

    [​IMG]

    Is there an easy way to sort this?

    Thanks!
     
    Josh-H, Jun 23, 2012 IP
  2. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #2
    So use attribute in CSS "line-height" that will resolve your issue..
     
    ashishkg, Jun 23, 2012 IP
  3. Josh-H

    Josh-H Active Member

    Messages:
    406
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Thanks! I will adjust that but it won't solve the lack of a margin on the right hand side of the top line or the lack of a margin on the lhs of the second line. Any way to sort that?

    I've tried adding in a paragraph tag and applying the padding to that.

    But then I get this:

    [​IMG]
     
    Last edited: Jun 23, 2012
    Josh-H, Jun 23, 2012 IP
  4. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #4
    good if you need other help PM me..
     
    ashishkg, Jun 23, 2012 IP
  5. Josh-H

    Josh-H Active Member

    Messages:
    406
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #5
    Sorry, but the above post isn't what I want it to look like. I only want the white background around the text, not to stretch all the way across. So like the first picture but with correct spacing and margins!
     
    Josh-H, Jun 23, 2012 IP
  6. dreamzdb

    dreamzdb Member

    Messages:
    41
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #6
    Try setting the span to display: block and see if that gives you what you are after.
     
    Last edited: Jun 23, 2012
    dreamzdb, Jun 23, 2012 IP
  7. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #7
    can you please send me the site URL so it will easy to tell you the solution, how you will fix the issue...
     
    ashishkg, Jun 24, 2012 IP
  8. Josh-H

    Josh-H Active Member

    Messages:
    406
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #8
    Thanks, I tried this but it also just gives this result:
    [​IMG]

    Any other ideas?

    (Thanks for the advice everyone so far!)

    I want it to look like this eventually:
    [​IMG]
     
    Last edited: Jun 24, 2012
    Josh-H, Jun 24, 2012 IP