javascript - How to dynamically hide a div in IE10+? -
i have button position: absolute displayed centered between 2 sections in latest chrome , firefox. however, in internet explorer 11 button moved left of page , displays half, destroys layout.
you can find js bin here.
css/less:
.button { z-index: 150; position: absolute; margin: 110px 0 0 -125px; height: 54px; width: 250px; letter-spacing: 3px; text-transform: uppercase; }
in order hide button in internet explorer, used following conditional comment:
<!--[if ie]> <style>#slogan .button {display: none;}</style> <![endif]-->
unfortunately, works in older versions of ie. conditional comments have been depreciated ie 10 upwards.
is there work around?
it's best fix styles work in browsers. tim medora , others have pointed out ie10+ more standards compliant these days.
html:
<!-- section 1 --> <div id="section1" class="container-fluid text-center"> <div class="container"> ... moved form here ... </div> <!-- - move form ".container" "#section1". - add .learn-more-container class form. --> <form class="learn-more-container" action=""> <button type="submit" class="btn btn-primary hidden-xs learn-more-btn">button</button> </form> </div><!-- /. section 1 -->
css:
then update #section1
css this:
#section1 .learn-more-container { z-index: 150; position: absolute; bottom: 0; width: 100%; margin-bottom: -25px; } #section1 .learn-more-btn { height: 54px; width: 250px; letter-spacing: 3px; text-transform: uppercase; }
that fix button work in browsers - in fact these changes work on ie8+.
here's updated jsbin showing changes: http://jsbin.com/todufuma/7/edit
Comments
Post a Comment