View Single Post
Old 05-14-2009, 12:44 PM   #24
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
non-rectangular images, narrower top part.

jellby's code for non-rectangular images (post 13) can be adjusted for images which are narrower on the top than on the bottom. after playing a bit i've found that just adding a negative margin to the top div (containing the image) seems to work just fine : i just added the code

Code:
div#piano {
     margin-left:-4.5em;
}
note, i wanted this image on the right side of the page, so my class names and floats are right instead of left in the original code.

here's all of it :

Code:
  
div.rightpic {
  float: right;
  clear: right;
  text-align: right;
  margin: 0 0.5em 0.5em 0; 
 border: solid green 1px;
}
  div.rightpic img {
  width: 100%;
}
/* Piano Image size: 212 x 501
/* width of the narrow top part :140px 
/* Height of the narrow (top) part: 180px
/* Width of the narrow part: 212*/

div#piano {
  max-width: 212px;
  width: 14em;        
  max-height: 10em;
  border: solid red 1px;
  margin-left:-4.5em;
}
div#piano + div.rightpic {
  width: 13.5em; 
  height: 21em; 
  margin-top: -0.5em;
}
i've attached my example (with borders to show the divs) and the original image, if you want to try it out.
Attached Thumbnails
Click image for larger version

Name:	nonrectangularimage_narrowtop.png
Views:	1465
Size:	53.5 KB
ID:	29012   Click image for larger version

Name:	pg115.gif
Views:	1327
Size:	22.9 KB
ID:	29013  
zelda_pinwheel is offline   Reply With Quote