Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Is there an alternative to negative margins for item overlaying other item in css?
  2. <p>Image caption</p><img />
  3.        
  4. <div><p>Image caption</p><img /></div>
  5.        
  6. <div>
  7. <p>Image caption</p>
  8. <img />
  9. </div>
  10.        
  11. div {
  12.   position: relative;
  13.   float:left;
  14. }
  15. p {
  16.   position: absolute;
  17.   top: 20px;
  18.   left: 10px;
  19. }
  20.        
  21. <p><span>Image caption<span></p><img />
  22.        
  23. p{
  24. display:block
  25. margin-right -100%
  26. }