• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Call images part by part using css sprites

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Call images part by part using css sprites

This topic is: resolved
  • This topic has 5 replies, 2 voices, and was last updated 11 years, 9 months ago by Tony @ AlphaBlossom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • September 17, 2014 at 12:08 am #124728
    jinsejose
    Member

    In order to optimize the images at the bottom(social icons), I combined it into a single png file. http://techbee.in/wp-content/uploads/2014/09/social-icons.png .Individual icons are of size 70*70px and the new social-icons.png with 70*420 having 6 social icons. Can anyone help me out to write the css to call the image part by part from one new social-icons.png image?

    http://techbee.in
    September 17, 2014 at 11:10 pm #124852
    Tony @ AlphaBlossom
    Member

    Hello,

    Change your html structure to look something like:

    
    <a rel="nofollow" href="https://twitter.com/techbeenew" target="_blank" class="social-link twitter">Follow me on Twitter</a>
    

    Then add this css to your theme's style.css file:

    
    a.social-link {
        display: block;
        float: left;
        height: 70px;
        text-indent: -9999px;
        width: 70px;
    }
    
    // Hover effect - can use opacity, or different background image, etc.
    a.social-link:hover {
        opacity: .7;
    }
    
    a.social-link.twitter {
        background: url(http://techbee.in/wp-content/uploads/2014/09/social-icons.png) repeat scroll 0 0 rgba(0, 0, 0, 0);
    }
    

    For each link you'll have to position your background image by changing "0 0" to something like "0 -71px". That's very approximate, you'll have to adjust the -71 to position it exactly, and each icon link will be a larger negative number (-71px, -141px, etc)

    That should get you going.

    Tony


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

    September 18, 2014 at 12:41 am #124857
    jinsejose
    Member

    Thank you Tony for your help. It works. But, I am unable to position it correctly. Presently, first 5 social icons are in first line and last on the next line. I need help to configure 3 in the first line and next 3 on the other. <br> and <p> tags didn't work.

    September 18, 2014 at 12:46 am #124858
    Tony @ AlphaBlossom
    Member

    I thought the width of the container would allow them to line up 3 x 3, but it looks like that's not the case.

    You can add "clear: left;" to a.social-link.pinterest and that will take care of it.


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

    September 18, 2014 at 12:52 am #124859
    jinsejose
    Member

    That's it. Thank you once again.

    September 18, 2014 at 12:53 am #124862
    Tony @ AlphaBlossom
    Member

    Awesome...looks great. Glad I could help.


    Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble