How to Set a Background Image in XHTML

Extensible HyperText Markup Language (XHTML) is an XML-based variant of the HyperText Markup Language used to develop Web pages. Unlike HTML, the XHTML language does not allow you to use the "background" parameter in conjunction with the <body> tag. If you want to attach a background image to your Web page, you must instead point to the location of the image using valid Cascading Style Sheet (CSS) code. Once you understand the proper syntax, setting a background image for your XHTML page becomes a quick task.

Instructions

    • 1

      Place your background image in the same folder as your XHTML document.

    • 2

      Open your XHTML document in a webpage-editing program (e.g., Adobe Dreamweaver, Microsoft Expression Web) or a text editor (e.g., Notepad, Wordpad).

    • 3

      Select the "Code" or "HTML" tab to force your editing program to show the document's XHTML code. If you use a text editor you can skip this step.

    • 4

      Locate the "</head>" tag. This tag is found near the top of the document.

    • 5

      Click just before the "</head>" tag, then press the "Enter" key to generate a blank line.

    • 6

      Insert the following lines of code into the blank line:

      <style type="text/css">

      body { background:url('file_name.jpg'); }

      </style>

      Substitute "file_name.jpg" with the actual name and file extension of your background image file.

    • 7

      Click "File" in the top menu bar of your editing program or text editor and select "Save" to confirm your changes.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured