Home arrow HTML arrow Page 3 - HTML Magic Edges
HTML

HTML Magic Edges


Imagine that you are reading a web page and you feel the need to use a calculator. You move your mouse pointer to the edge of the web page and a calculator appears from that edge. Imagine that you are reading a web page and you feel the need to put information in the message box (small form); you move your mouse pointer to the edge of the page and the message box appears. I like this scenario. If you do as well, keep reading and you'll learn how to make it a part of your web site.

Author Info:
By: Chrysanthus Forcha
Rating: 2 stars2 stars2 stars2 stars2 stars / 4
March 09, 2009
TABLE OF CONTENTS:
  1. · HTML Magic Edges
  2. · The Basics
  3. · Operation
  4. · Scrolling From Left

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
HTML Magic Edges - Operation
(Page 3 of 4 )

The inner DIV element is made to move relative to the outer DIV element. The inner DIV element is given the value of "relative" for its position property. Its position is relative to the outer DIV element. To make it move, we change this relative position continuously. That is, we change the left or top CSS value continuously.

The background-color of the outer DIV element is transparent. This means you can see through it. In other words, through it you see the body element. This outer DIV element is given fixed dimensions (fixed width and height). Most importantly, it is given the value "hidden" for its overflow property. When any containing element is given that value for its overflow property, then, for any internal element that overlaps the edges of the containing element, the overlapped portion is not seen by the user (it is cut off).

Under this condition, if you now make the inner DIV element move, it will appear as if the inner DIV element is coming from an edge of the containing element and/or entering an edge of the containing element. So, if you want an element to come out of the edge of the web page, have two elements as described above. Align an edge of the outer element to the edge of the web page. Do not give the outer element (DIV) a border. Make the inner element move away from the edge of the outer element that is aligned to the edge of the web page. The inner element will appear to come out of the edge of the web page. To make the inner element appear to enter the edge, just do the reverse.

We shall use the two DIV elements above with their contents for illustration in this part of the series. We shall still use the same elements, with some modification, in the next part of the series.

The Style Sheet

Let us talk about the style sheet for the two DIV elements. The inner DIV element has the ID "Calc." The value for its position property is relative. Its width is 205px and its height is 196px. Its background-color is brown. It is given a border of 2px. For simplicity, it is given a padding value of 0px and margin value of 0px.

The outer DIV element has an ID of "Cont." It has a width of 200px; this is 4px greater than that of the inner DIV element. It has a height of 209px; this is 4px greater than that of the inner DIV element. With this 4px increase, the inner DIV element should just fit into the outer DIV element.

The value of the overflow property of the outer DIV element is hidden (this is very important). Its background color is transparent. Its border is 2px and blue. For simplicity, it is given a padding value of 0px and a margin value of 0px.

Other elements on the page have CSS statements but are not vital to the understanding of this article series.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials