Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



SEO Class in Chicago, IL

Learn How To Optimize Your Website on July 26, 2013


Looking for personalized in-depth SEO training among your peers?



High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!



 


Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Making A Background Image Linkable


  • Please log in to reply
5 replies to this topic

#1 Hans G.

Hans G.

    HR 3

  • Members
  • PipPipPip
  • 99 posts

Posted 15 February 2008 - 03:00 PM

Hi folks! I'm building a Website in CSS and am pleased with everything I have done thus far. I have a background image on every page whose appearance is powered by a CSS file, which I call background.css, and sits in my css folder.

So the code on the html page reads: <link rel="stylesheet" type="text/css" href="css/background.css"/>

The code inside this file reads:

CODE
<!--
body { background-image: url(http://www.mywebsite.com/images/main-image.jpg); background-repeat: no-repeat; background-position: center top}
-->


I'm happy with everything, now I just need to make this background image linkable. I would like for people to click on this background image and have them go to the homepage, "mywebsite.com." How can I do this? Also, because this is a background image, it doesn't come out in print outs like all of the other images. Is there a way for a background image to show up in print outs?

#2 Ahmed

Ahmed

    HR 3

  • Active Members
  • PipPipPip
  • 96 posts
  • Location:Quebec, Canada

Posted 15 February 2008 - 04:52 PM

You can have the impression of a background image link by doing the following:

In CSS
CODE
#logolink {
                 display: block;
                 height: 100px;
                 width: 200px;
                 background-image: url(logo.jpg);
         }


In HTML
CODE
<a id="logolink" href="http://whatever"></a>


I have used this before so it works but its something I learned while doing some research smile.gif Here's the source

#3 Hans G.

Hans G.

    HR 3

  • Members
  • PipPipPip
  • 99 posts

Posted 15 February 2008 - 05:16 PM

Thanks, Ahmed. I tried it and it worked except for the fact that it takes the image and throws it on the top left side of the page. I need it to be centered. Do you know how to center it using that code?



#4 MaKa

MaKa

    HR 6

  • Active Members
  • PipPipPipPipPipPip
  • 856 posts
  • Location:Llantwit Major, Wales, UK

Posted 18 February 2008 - 04:00 AM

Add the following to the CSS code to center the image:
CODE
background-repeat:no-repeat;
background-attachment:fixed;
background-position:center;

Source: http://www.w3schools...ground-position

#5 Hans G.

Hans G.

    HR 3

  • Members
  • PipPipPip
  • 99 posts

Posted 21 February 2008 - 02:41 PM

thanks.

#6 piskie

piskie

    HR 7

  • Active Members
  • PipPipPipPipPipPipPip
  • 1,092 posts
  • Location:Cornwall

Posted 21 February 2008 - 07:28 PM

Looks to me as though a Search Engine would see it as a "Hidden Link" against T&C




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users