1 reply [Last post]
stroy
Offline
newbie
Last seen: 16 years 24 weeks ago
Joined: 2004-02-21
Posts: 1
Points: 0

Hi

trying to set margin-right in a table. Top - bottom and left margin shows like a charm.. but when setting right-margin its just ignored.
(In the example included the margins are set to 10 but originaly i just want 1px at the right and left)

This table is inside anotherone, displaying all css that is involved.
Anyone knows what stupid mistake I am doing?

the page example:

<html>
<head>
<title>example</title>
<link href="CSS/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="700"  border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="subnavbar">
      <tr>
        <td>hallo!</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

And the css page, style.css

body {
	font-family: Verdana, Geneva, Arial, helvetica, sans-serif;
	font-size: 10px;
	background-color: #f1f5fc;
	margin: 0px;
	padding: 0px;
}
.subnavbar {
	background-color: #99B3E9;
	padding: 2px 20px 2px 25px;
	border-top-width: 1px;
	border-bottom-width: 1px;
	border-top-style: solid;
	border-bottom-style: solid;
	border-top-color: #000066;
	border-bottom-color: #000066;
	margin-bottom: 10px;
	margin-right: 10px;
	margin-left: 10px;
	font-size: 10px;
	margin-top: 10px;	
}

Daybreak_0
Offline
Enthusiast
Sydney, Australia
Last seen: 16 years 38 weeks ago
Sydney, Australia
Timezone: GMT+10
Joined: 2003-11-15
Posts: 389
Points: 0

table and margins, problem

Not sure why, but you could try padding in the containing table instead.

Couldn't help myself but here is a rewrite
.subnavbar {
background-color: #99B3E9;
padding: 2px 20px 2px 25px;
border-top: 1px solid #000066;
border-bottom: 1px solid #000066;
margin: 10px;
font-size: 10px;
}

Regards
Day

The only way to learn is to do it yourself