Videogamer555 Posted September 6, 2014 Share Posted September 6, 2014 (edited) Here's the code (note that it has been truncated because there were hundreds of lines of copy/pasted "A"s and "Z"s in the original code, that I had to make it scrollable to simulate a large webpage) <html><head><title>index</title><style>a {z-index:1;}pre {z-index:-1;}</style></head><body><div style="position:fixed; left:0px; top:0px; width:100%; height:100%; background-color:rgba(0,0,0,0); z-index:0;"></div><pre>ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ</pre><a href="http://www.ebay.com">Ebay</a><pre>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre></body></html> Here's what it's supposed to do:The transparent DIV that covers the whole screen has a z-index of 0 so it should cover the PRE tags (which have a z-index of -1, and all their text content, making it unclickable, enforcing a copyprotection on it). At the same time, the A tags are set to have a z-index of 1, so they are above the transparent DIV, so they should remain clickable.Here's what's actually happening:Everything, INCLUDING THE HYPERLINK, is unclickable.What I want to know is why is it doing this, instead of what it SHOULD to be doing? Edited September 6, 2014 by Videogamer555 Link to comment Share on other sites More sharing options...
niche Posted September 6, 2014 Share Posted September 6, 2014 (edited) Your div does cover the screen. Change background color to green. Voila! I think this will help: http://philipwalton.com/articles/what-no-one-told-you-about-z-index/ EDIT: opacity will begin to answer your question. Remember that your developer tools lets to see your code graphically. Edited September 6, 2014 by niche Link to comment Share on other sites More sharing options...
dsonesuk Posted September 6, 2014 Share Posted September 6, 2014 z-index will not work unless position: is used along with it. Link to comment Share on other sites More sharing options...
Videogamer555 Posted September 6, 2014 Author Share Posted September 6, 2014 z-index will not work unless position: is used along with it. Ok, but isn't position already implicitly used? I mean position:static is the default, meaning that not using the position style element at all is actually equivalent to explicity typing position:static. Isn't that correct? Link to comment Share on other sites More sharing options...
dsonesuk Posted September 6, 2014 Share Posted September 6, 2014 z-index will not work unless position: other than position: static; is used along with it. http://www.w3schools.com/cssref/pr_pos_z-index.asp Link to comment Share on other sites More sharing options...
Videogamer555 Posted September 6, 2014 Author Share Posted September 6, 2014 (edited) Ok, I figured that out finally. This is the code I've got now. <html><head><title>index</title><style>* {position:relative; z-index:-1;}.NotProtected {position:relative; z-index:1;}</style></head><body><div style="position:fixed; left:0px; top:0px; width:100%; height:100%; background-color:rgba(0,0,0,0); z-index:0;"></div><pre>ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ</pre>This is a link to the <a class="NotProtected" href="http://www.ebay.com">Ebay</a> website.<pre>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre></body></html> It works now. However, the level of protection isn't quite as good as I expected (though some of this may be browser-dependent). Doubleclicking will always the first line of text (not sure why). Ctrl+A will still select everything. Getting your cursor to the right of the hyperlink and then selecting the hyperlink with click+drag as you bring your cursor across the hyperlink, will select the link and all the text up to that link. Not very good copyprotection. Too bad there's no way to simply mark a section of a webpage as completely unselectable and unclickable (to prevent unauthorized copying and saving of text and images). Edited September 6, 2014 by Videogamer555 Link to comment Share on other sites More sharing options...
Ingolme Posted September 6, 2014 Share Posted September 6, 2014 There's no way to prevent copying. 100% impossible. If your text is long enough and unique enough to be copyrightable you can put a copyright notice on the page and send DMCA reports to the web hosts of people who copy the content. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now