سؤال

I would like to add styling to the body tag, currently I end up with this code:

<body class="xspView tundra">
<div style="margin: 0px">

but I would like to achieve this:

<body class="xspView tundra" style="margin: 0px">

Is this possible without removing existing functionality (i.e. without removing dojo and default xpages functionality)?

هل كانت مفيدة؟

المحلول

Yes you can,

if you have for example one xpage called 'home'. You can add your style definitions to the tag in the xpage. For instance:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" styleClass="ddd" style="margin: 20px;">
// your content goes here
</xp:view>

If you have a multiple xpage design and you dont want to add these lines of code to every xpage you could use Themes to automaticaly add the styles to the body tag:

<control override="false">
    <name>ViewRoot</name>
    <property mode="concat">
        <name>styleClass</name>
        <value>xspView tundra</value>
    </property>
    <property mode="concat">
            <name>style</name>
            <value>margin: 20px</value>
    </property>
</control>

نصائح أخرى

You don't have to use a theme to add a style to the XPages body tag. You can do it right on the Page itself under the style property. The source looks like this:

<?xml version="1.0" encoding="UTF-8"?>
    <xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    styleClass="myBodyStyle">

    </xp:view>

Which renders to the browser as:

 <body class="myBodyStyle">

Add a css file that has a BODY entry. Put your margin there. Add the css to a theme if u want to use it globally

Why don't you do it in a css file? Include this:

 body {
        margin: 0px;
    }

Just like any HTML styling... Or, maybe I don't exactly understand what do you mean...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top