Hello

I have a small problem in the tutorial of the CSS (see below).

body
{
   width: 760px;
   margin: Self; / * To center our page * /
   margin-top: 20px; / * To avoid sticking with the top of the browser window. Try to show off! * /
   margin-bottom: 20px;    / * Ditto for the bottom of the browser * /
   background-image: url ("images / fond.png); / * A little background image to avoid having an old white background: p * /
}
<code type="Css">

Recommended Answers

All 3 Replies

I think it will be very helpfull if you can tell as what exactly your problem is.

I don't know what your problem is but I can see many problems: margin: self; does nothing. To centre, you'd need to use text-align: center; . background-image: url ("images / fond.png); will not display the image. Remove the spaces before and after the forward slash. <code type="Css"> is just wrong. Does nothing at all in any way except prevent the page from validating.

You need to provide us with information about the problem as just saying "I have a problem" means we can't help.

To add to Borzoi's post,

Typically the background-image property should have single quotes surrounding the destination - background-image: url('images/fond.png'); If you are trying to center the text and inline elements on your page, then use text-align: center; .

Otherwise if you are trying to center the body itself, it would be more logical to use a containing division.

<div id="container"></div>
#container {
    width: 760px;
    margin: 0 auto; /*this will center the division in the middle of the page*/
    margin-top: 20px;
    margin-bottom: 20px;
    background-image: url('images/fond.png');
}

As Kraai and Borzoi both said, without more information it is difficult to help you.


Regards, Arkinder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.