jaycode
jaycode

Reputation: 2958

How do I add inline css in Magentocommerce page from admin?

I just want to add

<style type="text/css>
 my_inline_style...
</style>

In one page. I know I can add things like this from Layout Update XML:

<reference name="head">
    <action name="addCss"><stylesheet>externalCss.css</stylesheet></action>
</reference>

But where is it documented to write inline css from that area?

Upvotes: 2

Views: 7220

Answers (1)

diegoide
diegoide

Reputation: 126

I had a similar situation and arrive at this solution. That is not elegant but is useful (you can add any text throw layout update). Add something like this to the layout update:

<reference name="head">
   <block type="core/text" name="custom_css">
      <action method="setText">
          <text><![CDATA[
             <style  type="text/css">
                .my-class  {
                    color: red;
                }
             </style> ]]>
        </text>
    </action>
   </block>
</reference>

Btw, It is hard to add the CSS style inline into the cms blocks because is hidden by some process inside the WYSIWYG editor after you save the block.

Upvotes: 11

Related Questions