html - Style Span and Jquery -
hopefully simple question i'm having blank moment over. i'm trying style span tag in html (which ties block of jquery).
my show span holding background set not width. while hide centers, , has appropriate width. not sure why. missing preventing first span "show" style completely? fiddle below.
.slider{ display:none; } .collapseslider{ display:none; } .sliderexpanded .collapseslider{ display:block; width: 100%; text-align: center; } .sliderexpanded .expandslider{ display:none; } .dark {background:#0082d1; text-align: center; width: 100%;} .light {background:#003a6f; text-align: center; width: 100%;} <p class="toggler" id="toggler-slideone"> <span class="expandslider dark">show</span><span class="collapseslider dark">hide</span> </p> <div class="slider" id="slideone"> <p>slide 1 lorem ipsum opsum...</p> <span class="closeslider">close</span> </div>
as time , continued support!
since span
inline element (they ignore width property) need set floating span or set display inline-block
in order let span have width
.dark {background:#0082d1; text-align: center; width: 100%;} span {display:inline-block } /*any of make span have block , don't ignore width property*/ span {display:block}
Comments
Post a Comment