July 19, 201115 yr Hi everyone, I have created a graphic in photoshop, it is a web button i would like to place on our website that links to anothe page. Here is the image: As you can see the image is a two tier image, the top image is how the image will look on the page in a static state, and the lower image is how the image will look on mouse over. I have place this image on our page, but of course the whole image is being displayed and i would like to position the image to an ideal position. I would eventually like four images like this but for the moment need to learn the skills of how to position an element and apply the hover effect. Here is the HTML code i have used to place the image: <img src="http://proaudioheadz.com/uploads/vow.png" This code has been placed inside of a text/HTML widget I have not done any CSS work yet and my coding skills are limited. Our publishing platform is latest WP. Could someone please advise me as to how to proceed. Regards, Wayne.
July 19, 201115 yr Hi everyone, I have created a graphic in photoshop, it is a web button i would like to place on our website that links to anothe page. Here is the image: As you can see the image is a two tier image, the top image is how the image will look on the page in a static state, and the lower image is how the image will look on mouse over. I have place this image on our page, but of course the whole image is being displayed and i would like to position the image to an ideal position. I would eventually like four images like this but for the moment need to learn the skills of how to position an element and apply the hover effect. Here is the HTML code i have used to place the image: <img src="http://proaudioheadz.com/uploads/vow.png" This code has been placed inside of a text/HTML widget I have not done any CSS work yet and my coding skills are limited. Our publishing platform is latest WP. Could someone please advise me as to how to proceed. Regards, Wayne. I'm assuming this will form part of your navigation? What I would do is set up an unordered list for the links (in this case - Music Production) and then set the background image of either the <li> or <a> element to the position of the image you require. You'd have to set the height of it to half of that of the image. Here's a good tutorial on how to set up CSS sprites: CSS-Tricks Sprites Tutorial EDIT: I've just realised that you're using WP. In this case, I'd set the pages up, and then add them to a Menu(Providing you're running WP3.0+) and then style the output as I've mentioned above. Edited July 19, 201115 yr by jonnyhocks
July 19, 201115 yr Author Hi jonnyhocks, I suppose it would be navigation yes, the image below should give an idea of the kind of layout i am trying to achieve. I know the buttons are big and garish and i will most likely redo the buttons once i have the understanding of how to do this (code wise) down, i just knocked these buttons up real quick. Ill take a look at that CSS tut you posted and see if its a viable way of achieving my goal. Thanks for your reply. Regards, Wayne.
July 19, 201115 yr Just to add to jonnyhocks info above, here's some code to demonstrate the basic concept... <!DOCTYPE HTML> <html> <head> <title>Page Title</title> <style type="text/css"> #musicbutton { display: block; width: 263px; height: 42px; background: url("uploads/vow.png"); } #musicbutton:hover { background-position: 0 -42px; } </style> </head> <body> <a id="musicbutton" title="Music Production" href="music-production.htm"></a> </body> </html> So the HTML code is a normal link, which is styled using CSS to control the background image position (42 is half the height of your full music production image).
July 19, 201115 yr Author Woops, the code in my text widget is not what i posted, it is actually this: <a href="http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png"><img src="http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png" alt="" title="music_production" width="263" height="84" class="aligncenter size-full wp-image-196" /></a> What do i need to modify in that CSS code you kindly posted? For reference, the page in question can be viewed here: http://www.proaudioheadz.com About half way down the page is the area where the buttons are to be placed..
July 19, 201115 yr Woops, the code in my text widget is not what i posted, it is actually this: <a href="http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png"><img src="http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png" alt="" title="music_production" width="263" height="84" class="aligncenter size-full wp-image-196" /></a> What do i need to modify in that CSS code you kindly posted? For reference, the page in question can be viewed here: http://www.proaudioheadz.com About half way down the page is the area where the buttons are to be placed.. If you're using a text widget, you would organise your links like this: <ul> <li><a>link 1</a></li> <li><a>link 2</a></li> <li><a>link 3</a></li> <li><a>link 4</a></li> </ul> Then you'd add the class/id names you'd need to style them accordingly using the code provided above.
July 19, 201115 yr At a glance, modify the background: url line so it reads: background: url("http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png"); ...and then your code in the text widget would be just: <a id="musicbutton" title="Music Production" href="music-production.htm"></a> where music-production.htm is the page the button will link to when clicked, and musicbutton matches the ID used in the style section. That will give you a single link styled using the #musicbutton style. jonnyhocks code above shows how to set up multiple links. Edited July 19, 201115 yr by Cascade
July 19, 201115 yr Author Ok, so at the moment my widget containing the HTML reads as: <img src="http://proaudioheadz.com/uploads/vow.png"<ul> <li><a><a href="http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png"><img src="http://www.proaudioheadz.com/wp-content/uploads/2011/07/music_production1.png" alt="" title="music_production" width="263" height="84" class="aligncenter size-full wp-image-196"</a></li> <li><a>link 2</a></li> <li><a>link 3</a></li> <li><a>link 4</a></li> </ul> and the CSS reads as: <!DOCTYPE HTML> <html> <head> <title>Page Title</title> <style type="text/css"> #musicbutton { display: block; width: 263px; height: 42px; background: url("uploads/vow.png"); } #musicbutton:hover { background-position: 0 -42px; } </style> </head> <body> <a id="musicbutton" title="Music Production" href="music-production.htm"></a> </body> </html> I refreshed the page and somthing has happened, not to sure what yet.. So the styling, someone told me i have to create a somthing called a "class"?
July 19, 201115 yr Ok, you're on your way there, you have the basic structure. One thing you've done wrong with the link is link to the actual image when you'll actually want to send your users to the corresponding page. We can't teach you HTML and CSS over here dude, it's time to pour a cuppa and start working your way through some tutorials: W3Schools
Create an account or sign in to comment