Skip to main content
Inspiring
Jul 25, 2017 7:30 PM UTC
Answered

why this img won't display?

Hi,

Having a difficult time figuring out why this does not display on my site when I test. The images folder is housed within the root of site (first level). Strangely, the same code works & displays on a completely different site. The space where button is still links outbound, and when I play with the opacity, I can see a black box over it:

.button  {

    background: rgba(0, 0, 0, 0) url("/images/button.png");

    background-repeat: no-repeat;

    background-position-y:center;

    background-position-x:center;

    background-size: contain !important;

    padding: 0 !important;

    position: relative;

    top:9px;

}

.button:hover {

   opacity: 0.8;

   background: rgba(0, 0, 0, 0) url("/images/button.png") !important;

   background-size: contain !important;

   background-repeat: no-repeat !important;

    background-position-y:center !important;

    background-position-x:center !important;

}

.social ul {

    float: left;

}

.social {

    padding: 33px 0 0 1px;

    margin-left: -20px;

}

.social a {

    background-size: contain;

    display: inline-block;

    height: 40px;

    width: 40px;

   

}

-------------------------------------------------------

<div class="col-md-3 col-xs-12 ">

    <div class="social">

          <div id="socialIcons">

<a href="https://www.linkedin.com" target="_blank"><i class="fa fa-linkedin-square" aria-hidden="true"></i></a>

<a href="https://www.facebook.com" target="_blank"><i class="fa fa-facebook-official" aria-hidden="true"></i></a>

<a href="https://twitter.com" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i></a>

<a href="https://plus.google.com" target="_blank"><i class="fa fa-google-plus" aria-hidden="true"></i></a>

<a href="https://www.youtube.com" target="_blank"><i class="fa fa-youtube" aria-hidden="true"></i></a>

<a href="https://www.pinterest.com" target="_blank"><i class="fa fa-pinterest" aria-hidden="true"></i></a>

<a class="button" target="_blank" href="http://www.custom-button.com/"></a>

         </div>

    </div>

</div>

Anything glaringly wrong with this? Thank you for your time!

    This topic is closed to new replies. Start a new post to keep the conversation going.
    osgood_Correct answer
    Legend
    Jul 26, 2017 2:02 PM UTC

    background: rgba(0, 0, 0, 0) url("/images/button.png");

    If your page is at the same level as the images folder within your site folder you dont need the leading / infront of your images folder:

    background: rgba(0, 0, 0, 0) url("images/button.png");

    7 replies

    Nancy OShea
    Community Expert
    Community Expert
    Jul 25, 2017 7:46 PM UTC

    You can't see the button?  Where is your stylesheet in relation to the HTML document?

    Nancy

    Translate
    Nancy O'Shea— Product User & Community Expert
    r_tistAuthor
    Inspiring
    Jul 26, 2017 1:55 PM UTC

    the social media icons I can see as they are referencing Font Awesome. Just my custom graphic for a button is not visible.

    The styles are within the single page head tags of the site... not in an external CSS file (not till I wrap things up; then I'll pull them into an external .css)

    Translate
    pziecina
    Legend
    Jul 26, 2017 1:59 PM UTC

    Is the file path for the image exactly the same as for the page in which the code works?

    Translate