Topic: Define Top Margin in CSS - How? Pages that link to <a href="https://ozoneasylum.com/backlink?for=24099" title="Pages that link to Topic: Define Top Margin in CSS - How?" rel="nofollow" >Topic: Define Top Margin in CSS - How?\

 
Author Thread
Black Hat
Bipolar (III) Inmate

From: Sin City (Can you guess where?)
Insane since: Sep 2004

IP logged posted posted 11-18-2004 21:43 Edit Quote

I need to define the following code in .CSS. How do I do it?

code:
topmargin="0"



-----------------------------------------------
TiNNoS || My Forums || My Gallery

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 11-18-2004 21:44 Edit Quote

Either

margin-top:0

or

padding-top:0

depending on exactly what it is you mean by "margin."


 

Black Hat
Bipolar (III) Inmate

From: Sin City (Can you guess where?)
Insane since: Sep 2004

IP logged posted posted 11-18-2004 21:51 Edit Quote

Ok, Slime:

Here is the entire code:

code:
<body oncontextmenu="return false" topmargin="0">



Now I can't do anything with

code:
<body oncontextmenu="return false"



Because thats my right click code.

But my page wont verify as VALID HTML unless I put

code:
topmargin="0">



into .CSS!

So how exactly would I go about doing that? What part of the .CSS would I put it in exactly? I'm assuming "Body" and what should it look like?


EDIT: After a little playing out I figured it out

-----------------------------------------------
TiNNoS || My Forums || My Gallery



(Edited by Black Hat on 11-18-2004 21:55)

liorean
Bipolar (III) Inmate

From: Umeå, Sweden
Insane since: Sep 2004

IP logged posted posted 11-18-2004 21:51 Edit Quote

Is that the attribute as used on the body tag? then you use the following CSS:

code:
html,body{
margin-top: 0;
padding-top: 0;
}


However, more often you want to eliminate not only the top margin.

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







Oh, script shouldn't be written into attributes in the HTML either. That's what you have the SCRIPT tag for.

code:
document.oncontextmenu=function(){return false;}



However, destroying a main UI feature such as right click is a bad thing. Preventing the context menu from appearing in any way is worse. There is nothing you prevent your user from doing by having a context menu not pop up on right click. However, you destroy some very valuable UI features for the user. For example, right click menu contain a lot of features: navigation (back/forward/stop/reload), page info (including save page and view source, which I guess is what you want to block), print, select all, bookmark, copy/paste, search web etc. A little depending on browser used and extensions installed, of course. In Mozilla and Opera, you may also have mouse gestures or rockers that use right click. None of these features is particularly hard to get at even without right click, but right click may be the way the user is most comfortable with.

As a user, I don't visit pages anew if they stop me from using right click. Luckily for me, both browsers that I use most often allow me to disallow pages overriding these...
--
var Liorean = {
prototype: ProgrammingTheoryGuru.prototype,
abode: "http://liorean.web-graphics.com/",
profile: "http://codingforums.com/member.php?u=5798"};

(Edited by liorean on 11-18-2004 22:15)

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 11-19-2004 01:00 Edit Quote

On a side note...why are you using 'right-click code' ?

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

IP logged posted posted 11-19-2004 01:24 Edit Quote

Good point DL-44 and liorean. Disabling the right click is a pain in the ass of the end users. And it's useless because :

  1. it's always possible to bypass it and access the code source and then "steal" everything you vainly tried to protect
  2. Tools > Options > Web Features > Advanced > Disable or replace context...



liorean
Bipolar (III) Inmate

From: Umeå, Sweden
Insane since: Sep 2004

IP logged posted posted 11-19-2004 01:42 Edit Quote

Another thing about right click prevention:

I've never, ever, seen it used on any page that held any content whatsoever worth stealing, neither script wise, design wise, graphics wise nor plugin wise. It can be done for provide the user with a site specific alternative context menu, which may be a good idea for some web applications, but in a web site/web page situation I never saw a good use case for it. In fact, I can't say I've seen it used in a way that enhances user experience except for some Microsoft showcases.

One things is definite though: it does not in any way protect your page or any elements of it's interface or design from being copied.

--
var Liorean = {
prototype: XMLGuru.prototype,
abode: "http://web-graphics.com/",
profile: "http://codingforums.com/member.php?u=5798"};

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 11-19-2004 03:39 Edit Quote

^ right.

in fact it most often just motivates people to steal something just for spite... =)

Of course, I apparently missed liorean's mention of the issue in the post before mine



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu