CSS: Hide Link Text, Let Your Images Shine Through

In systems like DotNetNuke and other such CMS systems you are sometimes stuck with auto-generated links containing auto-generated text. In most cases when you are trying to make a graphically rich UI with beautiful buttons this auto-generated crap becomes a real pain. In order to let your beautiful button graphics shine through just hide the text link tag using CSS.

Setting the Width and Height to 100% and the Display to block  allows the link to expand and fill its containing element, this is useful for links on logo images making the entire image clickable. Setting the Font-Size to 0px; makes the text completely disappear from the screen but is still there.

#logo a {
width:100%; height:100%;
text-decoration:none;

display:block;
font-size:0px;}

Published by

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#, ASP.net, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

2 thoughts on “CSS: Hide Link Text, Let Your Images Shine Through

  1. Thanks a lot! I was using this tutorial for pure-CSS rollover links, but empty anchor tags were just making the whole link vanish. Your method fixed it right up!

    Like

Leave a comment