Heading tags h1,h2,h3 and images

Posted on 2011-10-24
Last Modified: 2012-05-12
With heading tags can you put a image in them as well like this.

 <h2><img src="/images/base/headingicons/art_img.png" width="37" height="29">My Heading</h2>

Some people do a h2 tag with a background css but that is way to much code having a css rule for different heading image tags.  
Question by:stargateatlantis
    LVL 15

    Expert Comment

    yes you can
    LVL 11

    Accepted Solution

    I don't think you've asked anything here... can you reword this in the form of a question?

    Just as an FYI, your code above is missing a closing img tag (depending on your DOCTYPE) and and alt tag as well. You can actually use the contents of the img alt tag as the heading, so for example you could have:

    <h2><img src="/images/base/headingicons/art_img.png" style="width:37px; height: 29px" alt="My Heading" /></h2>

    Author Comment

    Thanks for the information.  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
    What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    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…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now