Extend the width of a label to fill the remainder of parent div

Discussion in 'CSS' started by kinkarso, May 23, 2014.

  1. #1
    I'm having a lot of problems trying to force a label tag to fill 100% of its parent's width, so that it can adjust depending on the user's window size.

    For some reason, if I set the width to 100%, it just sets a seemingly-arbitrary width regardless (http://d.pr/i/uLDV).

    I'm trying to change the width of these labels:

    [​IMG]

    Here is the code that I'm working with: http://jsfiddle.net/M8XYr/

    Anyone have any ideas on how to accomplish this?

    Thanks!
    Donny
     
    kinkarso, May 23, 2014 IP
  2. 2WDH.com

    2WDH.com Active Member

    Messages:
    143
    Likes Received:
    3
    Best Answers:
    5
    Trophy Points:
    68
    #2
    Hi Donny.
    Checked your code. Add "width: 100%;" to your ".tab" style.
     
    2WDH.com, May 24, 2014 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Are they floated? If so stop floating them... are they inline-level and/or set to display:inline? inline-block? If so set them to display:block. Really you shouldn't need to play games with setting the width as a blocks default behavior is to fill the available space.
     
    deathshadow, May 24, 2014 IP