{"id":30,"date":"2007-06-05T23:42:49","date_gmt":"2007-06-05T18:12:49","guid":{"rendered":"http:\/\/www.bin-co.com\/blog\/2007\/06\/iconify-links-with-css\/"},"modified":"2007-06-05T23:42:49","modified_gmt":"2007-06-05T18:12:49","slug":"iconify-links-with-css","status":"publish","type":"post","link":"https:\/\/www.bin-co.com\/blog\/2007\/06\/iconify-links-with-css\/","title":{"rendered":"Iconify Links with CSS"},"content":{"rendered":"<p class=\"intro\">Using icons is a must for all Web 2.0 apps. I have used this principle liberally in <a href=\"http:\/\/nexty.sourceforge.net\/\">Nexty<\/a>. <a href=\"http:\/\/www.bin-co.com\/blog\/2007\/05\/what-i-learned-from-nexty\/\">When I was creating Nexty, I learned<\/a> a simple trick that made using icons with CSS much easier.<\/p>\n<p>Go to <a href=\"http:\/\/www.bin-co.com\/php\/programs\/apps\/nexty\/demo\/\">Nexty<\/a> to see the icons<\/p>\n<p><img src='http:\/\/www.bin-co.com\/blog\/wp-content\/uploads\/2007\/06\/icons.png' alt='Iconification of Links in Nexty' \/><\/p>\n<h2>3 Types of Icons<\/h2>\n<p>I used 3 different classes for showing icons. They are..<\/p>\n<h3>icon<\/h3>\n<p>This class removes the text of the link and put the icon in its place. The icon is clickable.<\/p>\n<p>You can see this technique used in the <a href=\"http:\/\/www.bin-co.com\/php\/programs\/apps\/nexty\/demo\/projects\/\">Projects page<\/a>. See that &#8216;Edit'(Pencil) and &#8216;Delete&#8217; icons? They use this class.<\/p>\n<h4>XHTML code<\/h4>\n<pre><code class=\"html\">&lt;a class=\"icon edit\" href=\"edit.php?project=6\"&gt;Rename&lt;a&gt;<\/code><\/pre>\n<h4>CSS Code<\/h4>\n<pre><code class=\"css\">.icon {\n\tfont-size:0px; \/*Hides the text*\/\n\tpadding:6px 8px;\n}\n.edit {\n\tbackground:url(edit.png) no-repeat left center;\n}<\/code><\/pre>\n<h3>with-icon<\/h3>\n<p>This class shows the icon left of the link text. Both the icon and the text are clickable.<\/p>\n<p>The &#8216;Create new task&#8217; link in the <a href=\"http:\/\/www.bin-co.com\/php\/programs\/apps\/nexty\/demo\/\">home page<\/a> is an example of this.<\/p>\n<h4>XHTML code<\/h4>\n<pre><code class=\"html\">&lt;a class=\"with-icon tasks\" href=\"tasks\/new.php\"&gt;Create New Task...&lt;\/a&gt;<\/code><\/pre>\n<h4>CSS Code<\/h4>\n<pre><code class=\"css\">\n.with-icon {\n\tpadding-left:18px;\n}\n.tasks {\n\tbackground:url(tasks.png) no-repeat left center;\n}\n<\/code><\/pre>\n<h3>list-with-icon<\/h3>\n<p>This will insert the icon in every item for the given list.<\/p>\n<p>The drop down menus &#8211; Sections, Projects and Contexts are created using this technique.<\/p>\n<h4>XHTML code<\/h4>\n<pre><code class=\"html\">&lt;ul class=\"menu-with-icon projects\"&gt;\n&lt;li&gt;...&lt;\/li&gt;\n&lt;li&gt;...&lt;\/li&gt;\n&lt;\/ul&gt;<\/code><\/pre>\n<h4>CSS Code<\/h4>\n<pre><code class=\"css\">\n.list-with-icon li,.list-with-icon dt {\n\tpadding-left:18px;\n}\n.projects li {\n\tbackground:url(projects.png) no-repeat left center;\n}\n<\/code><\/pre>\n<h2>Icon Size<\/h2>\n<p>My icons were 16&#215;16 pixels &#8211; if you are using icons with a different size, you will have to change the amount accordingly.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Using icons is a must for all Web 2.0 apps. I have used this principle liberally in Nexty. When I was creating Nexty, I learned <a class=\"mh-excerpt-more\" href=\"https:\/\/www.bin-co.com\/blog\/2007\/06\/iconify-links-with-css\/\" title=\"Iconify Links with CSS\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,9,29,30],"tags":[87,142,144,172,194],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-xhtml","category-css","category-web20","category-web-development","tag-css","tag-icons","tag-iis","tag-links","tag-nexty"],"_links":{"self":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":0,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}