0

How to add style to page

asked 2008-10-07 20:07:49 +0800

esdlbt gravatar image esdlbt
30

I have a Window class that generates dinamic pages, I need to add a css style reference:
<link rel="stylesheet" type="text/css" href="stiles.css"/>
If I do it with
Style s = new Style("stiles.css");
window.appendChild(s);

It works but if I see the source code of the generated html the line:
<link rel="stylesheet" type="text/css" href="/elsotano/estilos/elsotano.css"/>
appears inside some div tags and not in the head part. Is there any way to append the style directly to the Page component?

Thanks

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2008-10-08 10:46:38 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Try this.

s.setDynamic(true);

link publish delete flag offensive edit

answered 2008-10-08 18:24:32 +0800

esdlbt gravatar image esdlbt
30

It doesn't work for me, setDynamic only eliminates the link tag but I need it, I'm planing to attach link tag fot the favorite icon and <script type="text/javascript"> tags to the head part.

link publish delete flag offensive edit

answered 2008-10-10 14:30:35 +0800

esdlbt gravatar image esdlbt
30

I found the solution using:
page.getLanguageDefinition().addStyleSheet(new StyleSheet("mystyle.css","text/css"));

link publish delete flag offensive edit

answered 2008-10-15 01:50:50 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

You can also specify it into lang-addon.xml directly.
For example,

<language-addon>
	<!-- The name of this addon. It must be unique -->
	<addon-name>myaddon</addon-name>

	<!-- Which language this addon will be added to -->
	<language-name>xul/html</language-name>
	
	<stylesheet href="/mystyle.css" type="text/css"/>
</language-addon>

link publish delete flag offensive edit

answered 2010-08-24 01:20:10 +0800

pav1in gravatar image pav1in
9

Hi,

first of all thanks for your tips!
To esdlbt: How can I set css style for all pages in a desktop. Of course I can cycle all pages calling Executions.getCurrent().getDesktop().getPages(), but since applying style should be a very basic thing in the web world, I'm looking for more elegant solution.

To jumperchen: How can I have multiple language-addon. Probably I didn;t search right, but I didn't find it yet.

Thanks,
Pavlin

link publish delete flag offensive edit

answered 2010-08-24 21:17:09 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Please take a look at the guide

link publish delete flag offensive edit

answered 2010-08-25 01:17:45 +0800

pav1in gravatar image pav1in
9

Thanks a lot, I was looking for that!

Pavlin

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: 2008-10-07 20:07:49 +0800

Seen: 785 times

Last updated: Aug 25 '10

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