PDA

View Full Version : code



Despect$
03-12-2006, 12:34 AM
What is the code to center a layout and make it touching the top of the screen? i have forgotten

Dentafrice1
03-12-2006, 12:44 AM
Ummm its css.. one sec



<html>
<head>
<style type="text/css">
body { margin-top: 0px; }
</style>
</head>
<body>
</body>
</html>


I think thats its..

Despect$
03-12-2006, 12:47 AM
nope, thats not it

Dentafrice1
03-12-2006, 12:48 AM
hmm.... idk off the top of my head.. im half asleep anyway.. and .. I just got back on this account.. so... ill find out soon! let me look in my code library



<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>


That aligns it all the way in the left..

Despect$
03-12-2006, 12:53 AM
For some reason it doesnt goto the very top but it should do for me, thanks Dent

Dentafrice1
03-12-2006, 12:54 AM
I dont think CSS can go into the minus range.. you could try -1 as one of those.. could you give me the link to the page your doing it on?

Kevin

Net-Margin
03-12-2006, 01:32 AM
Although I haven't used this try:


<style type="text/css">
<!--

* {
margin: 0px;
padding: 0px;
}

body {
margin-top: 100&#37;;
margin-bottom: 100%;
}
</style>

Dentafrice1
03-12-2006, 01:35 AM
Hmm.. That was what I was missing. padding.. but.. Hmm.. Idk.. maybe:




<style type="text/css">
<!--
body {
padding: 0px;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>

Mentor
03-12-2006, 01:55 AM
Easer way of removeing all padding and margins is just

body{
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
}
centering, depends, most the time this attribute will work

text-align:center;
Although it doesnt effect things live Div layers

Dentafrice1
03-12-2006, 01:57 AM
He wants the layout to be centered.. not the text. And he wants no margins and no padding.. soo hmm. I think mine would work.

Mentor
03-12-2006, 02:16 AM
thats what the code i provided did. The only thing it doesnt effect is div layers, which requre centering by setting there margins to auto, or offseting by negative margins.

Dentafrice1
03-12-2006, 02:20 AM
Listen to bag not me.. he is the king of the web design forum..

Tomm
03-12-2006, 09:04 AM
Or if you want to do it the old way using HTML:


<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

:Blobbed
03-12-2006, 10:10 AM
OR use divs:

<div align="center">
YOURLAYOUT
</div>

Soz if meh dumb :D

Dentafrice1
03-12-2006, 12:41 PM
He wants no margins blob

Despect$
03-12-2006, 01:28 PM
Fixed, i used dentafrices code

Dentafrice1
03-12-2006, 01:29 PM
Did it fix your problem?

Despect$
03-12-2006, 01:31 PM
yes, i just used the negatives

Dentafrice1
03-12-2006, 01:31 PM
I thought that would work.. ;)

Want to hide these adverts? Register an account for free!