html - workaround for getting alt for a css image -


i came know cannot have alt css generated image.there solutions having title atribute can alt effect on hovering on image,however when disable css not able see text in place of image.in case i need text appeared when css disabled .is there workaround getting text visible when css disabled.

    <span class="myimageclass">     hi     </span>     <style>     .myimageclass     {     height: 100px;     width: 200px;      background-image:url('http://cdn.osxdaily.com/wp-      content/uploads/2011/10/nstexturedfullscreenbackgroundcolor.png');     color:red;     overflow: hidden;     text-indent: -9999px;        }     </style> 

thanks, balaji.

you can use text-indent , overflow: hidden.

this not flexible method hope can use it.

.image {    width: 200px;    height: 100px;    display: block; /* needs inline elements span */    background: url(http://cdn.osxdaily.com/wp-content/uploads/2011/10/nstexturedfullscreenbackgroundcolor.png);    overflow: hidden;    text-indent: -9999px;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>    <div class="image js-image">    image alt  </div>    <button class="js-button">on/off styles</button>    <script>    $('.js-button').click(function() {      $('.js-image').toggleclass('image');    });  </script>


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -