I have margine on <div> on top and left that I dont want.

Here's the CSS:

#wrapper {
border:0;
margin: 0 auto;
top:-10px;
background:black;
}

Here's the pic: http://img410.imageshack.us/img410/5049/pokazmargina.jpg

Recommended Answers

All 11 Replies

html, body {
       margin: 0;
       padding: 0;
html, body {
       margin: 0;
       padding: 0;

It still has a margin,nothing changes. :S

A link to the page so we can examine more than three or four lines of code will help! (although it does look like the reset should have helped)

html file:

<head>




<title>Naslov</title>
<link rel="stylesheet" type="text/css" href="sveska1.css" />
<script type="text/javascript" src="main1.js">
</script>


</head>

<body style="background-color:violet;margin 0; padding: 0;">
<script type = "text/javascript">
		
var a = new Klasa();

a.Render();
	
</script>
</body>
</html>

js file:

function Klasa()
{
	
	
	
		this.Render = function(){
			
			// Pravim glavni DIV koji ce predstavljati body
			var el = document.createElement("div");
		
		  var el1 = document.createElement("div");	
			el1.id = "wrapper";
			el1.className = "wrapper";
			el.appendChild(el1);
  		//alert(el1);
    
			var el2 = document.createElement("div");
			el2.id = "gore";
			el2.className = "gore";
			el1.appendChild(el2);

		
		// Pravim DIV centar koji ce sadrzati navigaciju i sadrzaj
		var el3 = document.createElement("div");
		el3.id = "sredina";
		el3.className = "sredina";		
			
		el1.appendChild(el3);
				
		var el4 = document.createElement("div");
		el4.id = "dole";
		el4.className = "dole";
		el1.appendChild(el4);
		
		
		//Sada html koji se nalazi u okviru upisujem u dokument.
		document.write(el.innerHTML);
		//ili
		//document.body.innerHTML = el.innerHTML;
	};
	
		
}

CSS code:

#wrapper { 
 border:0;	
 //margin: 0 auto;
 //top:-10px;
 background: black;
 margin: 0;
 padding: 0;
}

#gore{
	
	width: 760px; 
	height: 90px;

	background:red;
	margin: 0 auto; //auto je da stoji na sredini
	
}

 
#sredina{
	background:grey;
	width: 760px; 
	margin: 0 auto;
	height:400px;
		
}

#dole{

	margin: 0 auto; 
	text-align:center;
	width: 760px; 
	height:40px;
	background:green;
	
}

#linkovi{

	right:150px;
	text-align:center;
	
}

Dump the totally unnecessary javascript!!!!

Write html.

Is here someone serious to help me solve this?

In your HTML file. There is no html tag. Check out and make sure your codes were valid.

I've corrected it,still the same. :S

I was serious.
Writing javascript whose sole purpose is to create create something you can more easily create is straight html is not a good way to build a web page. Yes, you could use javascript to write some variable content to an area, but not to write your basic html and layout divs.


PS the reset seems to be lacking a closing } , but I'm assuming that was just a typo here and it is correct on the actual web page.

<style>
body{margin:0;padding:0;}
img{margin:0;padding:0;}
</style>
<body margin=0 padding=0 leftmargin=0 topmargin=0><img src="somimage.jpg" vspace=0 hspace=0>
<body>
body margin=0

yes this is the solution,i've found it my self

you solved the thread!

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.