• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Just wondering

 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this bit of code in a book.
document.myIMG.style.clip="rect(0 100 80 5)";
and
<img src="image.jpg" name="myIMG" style="position:absolute">
This code shows just part of a jpeg image.
This seems to use cascading style code. What does position:absolute mean, and is it necessary?
Can this be done using just HTML and JavaScript? I know those a lot better than cascading style.
I just know someone is going to tell me, "You should study CSS too!"
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
position:absolute places the element at a fixed point on the page relative to the page origin. Any such elements are not part of the normal page layout flow.

There is no way to effect either of absolute poitioning or clipping without CSS.
 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
position:absolute places the element at a fixed point on the page relative to the page origin. Any such elements are not part of the normal page layout flow.

There is no way to effect either of absolute poitioning or clipping without CSS.



That is incorrect.

Position: absolute

Positions an element from its containing block (nearest positioned ancestor), or, if no such positioned ancestor is found, then the root node is used.

But don't take my word for it.
http://www.w3.org/TR/CSS21/visudet.html#containing-block-details
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correctly corrected. My answer assumes a top-level element.
 
reply
    Bookmark Topic Watch Topic
  • New Topic