4
Contributors
11
Replies
12
Views
7 Years
Discussion Span
Last Post by suncica2222
0
html, body {
       margin: 0;
       padding: 0;

It still has a margin,nothing changes. :S

0

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)

0

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;
	
}
0

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

0

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.

Edited by drjohn: n/a

0
<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>
0
body margin=0

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

you solved the thread!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.