Am 14.03.2013 14:25 schrieb Tom Livingston:
Can you apply the border to the second section instead of the nav?

Thank you for this idea. With the sample code I provided, this would do it indeed. Anyway as the content is CMS driven, I have no control on the number of sections above the navigation.

I wonder how people use the adjacent selector with HTML5 elements that need to be nested, as legacy browsers do not recognize the new elements, such as:

<article>
  <div class="article">
  ...
  </div>
</article>
<footer>
  <div class="footer">
  ...
  </div>
</footer>

The selector "article + footer" will probably not work in legacy browsers, while ".article + .footer" does not match the elements.

On Thu, Mar 14, 2013 at 7:26 AM, Markus Ernst <derer...@gmx.ch> wrote:

Hello
I have a structure of nested elements somehow like:
<article>
    <div>
      <section>
        <table>
          ...
        </table>
      </section>
      <section>
        <p>This second section is not always present!!</p>
      </section>
    </div>
</article>
<nav>
    <div>
      <ul id="navi1">
        ...
      </ul>
      ...
    </div>
</nav>
And the CSS:
table {
    border-top: 3px dotted green;
    border-bottom: 3px dotted green;
}
#navi1 {
    border-top:3px dotted green;
}
Now, I would like to remove the border on #navi1, when there is no
content between the table and #navi1. The following do not work:
table + #navi1 {
    border-top:none;
}
article div section table + nav div #navi1 {
    border-top:none;
}
Is there a possibility to select "adjacent" elements, if they are nested
separately? (I know about applying classes and such, but I'd like a
solution where I don't need to know at coding time whether there is
content after the table or not.)
Thanks for a hint!
Markus
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/



______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to