You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Christian Hoofe <hc...@yngoor.de> on 2005/06/27 18:17:35 UTC

Problem: Centering images with kupu

The kupu enables to center pictures which results in code like this

<div align="center">
<img class="image-left" alt="t4.jpg" src="test-lvl51/t4.jpg"><br>
</div>

After saving I get

<div>
<img border="0" src="test-lvl51/t4.jpg" alt=""><br>
</div>

I think what is needed here is something like this

css:
img{
display:block; /*allows the element to take auto margins*/
margin:0 auto; /*centers in compliant browsers*/
text-align:center; /*centers in old versions of IE*/
}

in the div statement.

Any ideas how to implement this as a div style?

Thanks
Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problem: Centering images with kupu

Posted by Christian Hoofe <hc...@yngoor.de>.
<hc <at> yngoor.de> writes:

> 
> The kupu enables to center pictures which results in code like this
> 
> <div align="center">
> <img class="image-left" alt="t4.jpg" src="test-lvl51/t4.jpg"><br>
> </div>
> 
> After saving I get
> 
> <div>
> <img border="0" src="test-lvl51/t4.jpg" alt=""><br>
> </div>
> 
> I think what is needed here is something like this
> 
> css:
> img{
> display:block; /*allows the element to take auto margins*/
> margin:0 auto; /*centers in compliant browsers*/
> text-align:center; /*centers in old versions of IE*/
> }
> 
> in the div statement.
> 
> Any ideas how to implement this as a div style?
> 
> Thanks
> Christian
> 


I found a solution for the problem. Not the best from a CSS point of view, but
it works. (Lenya 1.2.4)

In

.../build/lenya/webapp/lenya/resources/kupu/apache-lenya/lenya/kupusave.xsl

I added

   <xsl:template match="xhtml:div">
    <div>
        <xsl:if test="string(@align)">
          <xsl:attribute name="align">
            <xsl:value-of select="@align"/>
          </xsl:attribute>
        </xsl:if>   
      <xsl:apply-templates/>
    </div>
   </xsl:template>


and for the 'p'-tag

    <xsl:template match="xhtml:p">
     <p>
        <xsl:if test="string(@align)">
          <xsl:attribute name="align">
            <xsl:value-of select="@align"/>
          </xsl:attribute>
        </xsl:if>   
      <xsl:apply-templates/>
    </p>
   </xsl:template>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org