Forums / Developer / CSS in html tag <style>

CSS in html tag <style>

Author Message

Fabio Piovesan

Tuesday 25 March 2008 4:36:47 am

Hi,
I need to insert some CSS rules in my pagelayout, but I can't import an existing .css file because I need dynamic elements that I fetch from an object.

Is it possible to insert a tag <style> without importing anything and writing embed CSS rules? I try width:

{literal}
<style type="text/css">

#p0 a

{
font-weight:bold;
text-transform:uppercase;
text-decoration:none;
color:#616263;
font-size:12px;
}

#p0 a:hover

{
font-weight:bold;
text-transform:uppercase;
text-decoration:none;
color:#d05024;
font-size:12px;
}

</style>
{/literal}

But this doesn't work and then I can't do what I want: building dynamically a tag <style> width some parametrs stored in an ezobject.

Any suggestions?

Patrick Kaiser

Tuesday 25 March 2008 5:33:27 am

not sure what you are trying to do exactly, but you can try something like this:

<style type="text/css">
#p0 a
{ldelim}
font-weight:bold;
text-transform:uppercase;
text-decoration:none;
color: {$yourEzObject.data_map.yourColorAttribute.content|wash( 'xhtml' )};
font-size:12px;
{rdelim}
</style>

best regards,

patrick


Best regards,

Patrick

Fabio Piovesan

Tuesday 25 March 2008 6:09:13 am

Thanks very much,
I made a very stupid mistake in my foreach cycle and so it seems that any css roule I wrot did't work. But now it's ok.

Thanks