Matt Loughton
Matt Loughton

Reputation: 15

Why is my CSS relative positioning not working?

I am having trouble moving any of my divs with relative/ absolute ect positioning. Any help would be appreciated, cheers.

Code:

<div id="game"><img src="gta-game.jpg" height="100" width="70" alt="gta"/></div></li>
    <div id="gamename">Grand Theft Auto V</div>
    <div id="rating">9/10<div>
    <div id="system">PS4</div>

CSS:

#game{
height: 100px;
width: 70px;
display: relative;
left: 50px;
}
#gamename{
display: relative;
right: 50px;
}
#rating{
display: relative;
right: 100px;
}
#system{
display: relative;
right: 200px;
}

Upvotes: 1

Views: 95

Answers (2)

user3434588
user3434588

Reputation:

You are using display. You should be using position. Try this:

#game{
height: 100px;
width: 70px;
position: relative;
left: 50px;
}
#gamename{
position: relative;
right: 50px;
}
#rating{
position: relative;
right: 100px;
}
#system{
position: relative;
right: 200px;
}

Upvotes: 0

firefoxuser_1
firefoxuser_1

Reputation: 1839

The correct property is position: relative, not display: relative.

Upvotes: 2

Related Questions