/    Sign up×
Community /Pin to ProfileBookmark

Hey,

When i put my header div as a “position:relative”, i get automatic positioning which is about 15px top and 10px left (more or less), i think its a built-in deafult of the html or css ….

Anyhow. Is there anyway to cancel that (beside telling the div to start -15px from top and left)?

I hope my question is clear
tnx in advance,

Bugy

to post a comment
CSS

10 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelJul 07.2007 — <style>

* {margin:0; padding:0;}

</style>

Removes default padding & margin on all elements. All browsers (esp. IE) use a 'default', this removes it.
Copy linkTweet thisAlerts:
@yoda69authorJul 07.2007 — tnx for the reply.

The problem with that syntax is that if i integrate it in css style file, it affects all lines of text as well. is there a way around it?

tnx,

bugy
Copy linkTweet thisAlerts:
@macthewebJul 07.2007 — tnx for the reply.

The problem with that syntax is that if i integrate it in css style file, it affects all lines of text as well. is there a way around it?

tnx,

bugy[/QUOTE]


Just remove margin and padding on the body. Then your next level page element starts top and left.

<style>

body {margin: 0; padding: 0;}

</style>
Copy linkTweet thisAlerts:
@WebJoelJul 07.2007 — Just remove margin and padding on the body. Then your next level page element starts top and left.

<style>

body {margin: 0; padding: 0;}

</style>[/QUOTE]


Exactly. :-) I prefer my 'all element reduced to zero' because I encounter problems later on with some element like <form> or so forth, but "body" pad-less/margin-less does solve the immediate problem.

I might even go:

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

-just to be sure that I got it all (and still, not to affect any element other than html & body).
Copy linkTweet thisAlerts:
@macthewebJul 08.2007 — Exactly. :-) I prefer my 'all element reduced to zero' because I encounter problems later on with some element like <form> or so forth, but "body" pad-less/margin-less does solve the immediate problem.

I might even go:

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

-just to be sure that I got it all (and still, not to affect any element other than html & body).[/QUOTE]


Using the body selector is enough. html isn't necessary.
Copy linkTweet thisAlerts:
@yoda69authorJul 08.2007 — tnx very much for your help guys.

solved my problem
Copy linkTweet thisAlerts:
@____MaNiC_MoE____Jul 08.2007 — so, I guess, you're done with it, lolz ?

I came 2 late, lool
Copy linkTweet thisAlerts:
@yoda69authorJul 09.2007 — okay.... so wasn't as done as i thought i was.

one thing is happening now, i'm getting this irritating margin at the bottom of my screen. meaning under the "footer" div there are about 25px of empty white space (which is a bummer cause my footer background is a colored gif :-(

the only way i managed to overcome this is to enter a "top:40px;" however that has other disadvantages.....

so any way to overcome it? isn't the line i entered for the body:

body {margin: 0; padding: 0;}

suppose to solve this?

tnx once more,

Bugy
Copy linkTweet thisAlerts:
@macthewebJul 09.2007 — have to see the code to understand the problem
Copy linkTweet thisAlerts:
@yoda69authorJul 09.2007 — found the problem,

I had a bottom margin hiding somewhere...

tnx anyway
×

Success!

Help @yoda69 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...