|
-
October 9th, 2008, 11:17 PM
#1
How 2 clip an area of an image on the fly ?
Dear all.
I've created a custom style for list items that uses an image:
http://Yovav.com/Temp/ListItemImages.gif
The problem is that when the list item is higher than 16 pixels the next image shows up (while it should be white)
See the problem in this example:
http://Yovav.com/Temp/ListItemImageProblem.gif
I would like to be able to clip just the area I need for the image
How can I do that ?
This is the style I'm using:
.CustomUL LI
{
background:url("../Images/Controls/ListItem/ListItemImages.gif") no-repeat 0px0px;
list-style-type:none; /* circle */
line-height:16px;
margin-top:7px;
margin-bottom:7px;
padding-left:22px;
}
.CustomUL LI.SignVGray {background-position:0px-80px;}
.CustomUL LI.SignVBlack {background-position:0px-96px;}
.CustomUL LI.SignVRed {background-position:0px-112px;}
.CustomUL LI.SignVGreen {background-position:0px-128px;}
.CustomUL LI.SignVBlue {background-position:0px-144px;}
And in the HTML:
<ul class="CustomUL">
<li class="SignArrowBlack">Test1</li>
<li class="SignArrowBlack">Test1</li>
<li class="SignArrowBlack">Test1</li>
</ul>
Last edited by Yovav; October 10th, 2008 at 12:03 AM.
Best Regards - Yovav
-
October 10th, 2008, 07:14 AM
#2
Re: How 2 clip an area of an image on the fly ?
You can set the bounds and then hide the overflow.
Code:
display: block;
height: 16px;
overflow: hidden;
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
October 10th, 2008, 12:31 PM
#3
Re: How 2 clip an area of an image on the fly ?
Thanks for your help,
When I'm limiting the height it also limits the text of the List Item element
so for example - if it has 3 lines it will only show the first line (16 pixels high)
I'm trying to limit the list item image while showing more that one line of text on the list...
Best Regards - Yovav
-
October 11th, 2008, 05:13 AM
#4
Re: How 2 clip an area of an image on the fly ?
I have searched, and I have found no solutions. There are not many options about background pictures. So, you could have several pictures instead of only one, or you could have a lot of spaces between each picture in your ListItemImage.gif file.
-
October 11th, 2008, 11:41 AM
#5
Re: How 2 clip an area of an image on the fly ?
Thanks for the reply,
I also thought about this option,
But I still wonder as I saw people using a one big image that includes all kind of images...
Best Regards - Yovav
-
October 11th, 2008, 08:36 PM
#6
Re: How 2 clip an area of an image on the fly ?
 Originally Posted by Yovav
I'm trying to limit the list item image while showing more that one line of text on the list...
So, you can apply my same method to just the image itself.
Code:
<div style="display: block; height: 16px; overflow: hidden;"><img src="image1.png" alt="" /></div>
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
October 12th, 2008, 02:51 AM
#7
Re: How 2 clip an area of an image on the fly ?
How about something along the lines of positioning the image in a sub element?
HTML Code:
<div style="width: 16px; height: 16px; overflow: hidden;">
<div style="position: absolute; top: -100px; left: -100px; background-image: url('');"> </div>
</div>
That should show pixels (101, 101)-(117, 117).
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|