Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2012
    Posts
    137
    Thanks
    1
    Thanked 1 Time in 1 Post

    How to set style dependant on adjacent element

    Hello,

    I have a div that is populated with a bunch of span tags, each having there own class. They are colored differently to show separation. They show up in the div side by side. The problem is that when the 'glossDef' span has a lot of text its height expands based on padding (I think it's padding, not important) and the 'glossAcro' span stays the same height so that now you see a white space under the 'glossAcro' span.

    I need this 'glossAcro' span to expand in height whenever the 'glossDef' span expands in height. Is this easily done?

    Code:
    <div>
    <span class='glossAcro'>AC</span><span class='glossDef'>AC def</span>
    <span class='glossAcro'>DC</span><span class='glossDef'>DC def</span>
    </div>

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    411
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Code:
    <div>
    <span class='glossAcro'>AC</span><span class='glossDef'>AC def</span>
    <span class='glossAcro'>DC</span><span class='glossDef'>DC def</span>
    </div>
    Looks like all it needs is a styled wrapper, but without the context (CSS and HTML) there is nothing possible except guesses.
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •