0

Background image for <a> tag is not working

asked 2011-10-10 15:02:55 +0800

gyowanny gravatar image gyowanny
283 1 2 6

Hi,

I'm trying to set a background image for a given <a> component but it's not working:

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<style>
	.my-background{
  		background-image: url('/images/link1.jpg');
	}
</style>
<window title="new page title" border="normal" width="400px" height="400px">
	<a sclass="my-background">My Link</a>
</window>
</zk>

I've already tried to put an image from web (http://www.plugmasters.com.br/downloads/icones/banco-de-icones/template/aqua-button.png) instead of a local image and it didn't work too.

Thank you,

Gyo

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2011-10-10 20:02:41 +0800

RichardL gravatar image RichardL
768 4

You can do this:

<zk>
<style>
	.my-background{
  		background-image:url(http://www.pageresource.com/images/scare.jpg);
	}
</style>
<window title="new page title" border="normal" width="400px" height="400px">
	<a sclass="my-background">My Link</a>
</window>
</zk>

link publish delete flag offensive edit

answered 2011-10-11 04:16:43 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2011-10-11 04:17:53 +0800

Seems the used png image from the bank site have withe spaces around the button. I played a little bit with it and cut these white spaces and save the image as a gif.

<?xml version="1.0" encoding="UTF-8"?>

<zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">

<style>
.my-background{
background-image:url(http://www.forsthaus.de/aqua-button.gif);
no-repeat;
background-size: 100%;
font-size:32px; }
</style>

<window title="new page title" border="normal" width="400px"
height="400px">
<a sclass="my-background">My Link is here!</a>
</window>

</zk>

best
Stephan

link publish delete flag offensive edit

answered 2011-10-11 09:20:50 +0800

gyowanny gravatar image gyowanny
283 1 2 6

HI Terry,

yeah, it's something to do with my images. I tested your code and it worked fin.

Thanks,

Gyo

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-10-10 15:02:55 +0800

Seen: 248 times

Last updated: Oct 11 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More