0

I am trying to set a background image to a <header> tag into a XSL document with CSS but it's doesn't work (the image doesn't display). The path of the image is correct. If I set the image with the <img>balise, It's work.

XSL code:

<xsl:template match="/">
    <html>
        <head>
            <meta charset="utf8" />
            <title>Bibliothèque</title>
            <link type="text/css" rel="stylesheet" href="exercice9.css" />
        </head>

        <body>
            <header></header>
            ...

CSS code:

body
{
    font-family: sans-serif;
}

header
{
    background: url(res/titre.gif");
}

Do you have any idea?

Thank :)

mathieu_b
  • 383
  • 1
  • 5
  • 19

1 Answers1

0

Use the following process:

  • Set the style of the header to the dimensions of the image
  • Include the XHTML namespace in the root element:

    <xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns="http://www.w3.org/1999/xhtml"
            >
    
  • Include the xsl:output element to set the HTML5 doctype:

    <xsl:output method="xml" encoding="utf-8" version="" indent="yes" standalone="no" media-type="text/html" omit-xml-declaration="no" doctype-system="about:legacy-compat" />
    

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265