I've got a fluid row in which I need to show and hide spans depending on how the user wants to see the page (single-view, split-view). Using jQuery, I show/hide spans as well as change their classes:
MySpan1 View:
<div class="row-fluid">
<div id="myspan1" class="span12"></div>
<div id="myspan2" style="display:none;"></div>
</div>
MySpan2 View (this one doesn't layout correctly):
<div class="row-fluid">
<div id="myspan1" style="display:none;"></div>
<div id="myspan2" class="span12"></div>
</div>
Split View:
<div class="row-fluid">
<div id="myspan1" class="span6"></div>
<div id="myspan2" class="span6"></div>
</div>
I'm having a problem with the following responsive stylesheet rule:
.row-fluid [class*="span"]:first-child
{
margin-left: 0;
}
This rule is only removing left-margin on span classes if they are the first child of the parent. Well, in the case of MySpan2 view, my div is the second child of the parent (even though it's the first one with a span* class. As a result, a left margin is still being applied. Is there a css pseudo selector that will do what I'm expecting? I want to select only the first element of the matching set, not whether or not it is the first child of the parent. I can fix this using jQuery and some additional css, but I was hoping for a more global resolution.