Solved

Base64 icons

Posted on 2011-09-07
3
294 Views
Last Modified: 2013-09-15
Hello,
    I am using sencha touch in a project.  I have encoded some icons in the css using Base64. The resulting icon classes work great in sencha touch. The problem is I would like to reuse some the icons using good ole html and css. I have seen examples like this that uses Base64.

<img alt="Embedded Image"
  src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />

the problem is my icons are already setup as a class for sencha touch. like so..

       .favsIcon {-webkit-mask-box-image:url(data:image/png;base64,iVBORw0K....
}

How do I call this class to display the icon in html? or even as a background image of another class? I want to avoid having to use the icon file if I don't have to.

Thanks
0
Comment
Question by:JohnBran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 36500219
You can declare an "icon" class-ex:

.icon {
  width:100px;
  height:100px;
  background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...);
}

Then to use it, you just assign that class to the element:
<div class="icon">...</div>

An element can have multiple classes. You just need to separate them with a space. Thus, you can "reuse" your "icon" class definition:
<div class="someClass someOtherClass icon">...</div>

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question