Hi!
I am trying to build a tribute page with the following code, which just gives a nice grey background to the content I’m going to fill in it.
Everything is working fine except that the right margin is not showing up in the web page. I’ve set margin-right to the same value as margin-left, and left margin is showing up, but right margin isn’t.
Please help me out here, I’m sharing the code that I’ve written so far:
<style>
#outer{
position:absolute;
background:rgb(232,232,232);
margin-left:5px;
margin-right:5px;
margin-top:25px;
margin-bottom:25px;
height:100%;
width:100%;
border-radius:2%;
}
</style>
</head>
<body>
<div id="outer">
</div>
</body>
type or paste code here
I am not that experienced, but I started to play with your code, because it did the same in my browser I couldn’t figure out why.
This is how I made it work, by removing position, height and width
<style>
#outer{
background:rgb(232,232,232);
margin: 25px 5px;
border-radius:5px;
}
</style>
and giving the div some content (a p element with some lorum ipsum).
Addendum: I believe the width attribute refers to the parent element. So if you add margins to your div and then add width equals 100% of the parent element (in this case body) you get into trouble.