473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to do the fit image size in background image

Hello everyone,
I would like to know how to fit the limited size in background image of div tag.
My code is

Expand|Select|Wrap|Line Numbers
  1. <style>
  2.  #gallery_image{
  3.     width:156px; 
  4.     height:156px; 
  5.     float:left;
  6.     background-color:#a7a9ac;
  7.     border:solid 2px #D1D3D4;
  8.     margin:0 15px 15px 0;
  9.     padding:0;
  10.  
  11. </style>
  12.  
  13. <div id="gallery_image" style="background-image: url(<%=imgSymlink+portfolioFile.getPath() %>) ">
  14.     <div id="gallery_image_top">
  15.                 <div style="float:left;"><img src="<%=imageIconImage%>" width="16" height="16" style="border:0;" /></div>
  16.  
The image is showing only x=0,y=0, width=156 height=156 of the original image.
I want to fit the whole image in width=156 and height 156 of the div tag.
You can see the example of sunflower image file.
Thanks and Regards,
Yan Paing
Attached Images
File Type: jpg Screen shot 2010-07-19 at PM 04.48.41.jpg (19.1 KB, 518 views)
File Type: jpg Sunflower_as_GIF.jpg (8.1 KB, 151 views)
Jul 19 '10 #1
1 2055
Dormilich
8,658 Expert Mod 8TB
you can accomplish that by using the background module of CSS3, however, be aware that this is not supported by every browser.

background tricks with CSS3
Jul 19 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: perspolis | last post by:
hi all I want to decrease size of an image without losing it's content. for example decreasing size of an image by 20%. thx in advance
0
by: eff_kay | last post by:
How can I use an image as background image for header of a datagrid Stuck!!!!! eff_kay
1
by: Paraki | last post by:
Hi, How do you compress the image content and display the image using .net framework classes in an ASP.net application? My target is to set the centre location where the user clicks on the image...
1
by: sleem | last post by:
I designed a little function to resize a window based on the clients screen resolution, and apply an appropriate background image. function resize_2_spec() { if (screen.width>640) {...
2
by: senfo | last post by:
I'm using an ImageList component in conjunction with a ListView control to display images and it appears as though it's only possible set the size of an image globally, for the entire list. Is...
0
by: Miguel Pires | last post by:
Hi all, I have one Mdi Container (Parent) and on this form i wont to set a small image in bottom Right corner, i have insert a imagebox and all was ok until i open a mdi child form and move were...
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
4
by: GArlington | last post by:
I am trying to implement an image map (in this particular case a country map) with few <area ...>s on it. The challenge is to add background image (dot) to each <areaso it will display over the...
2
by: thephatp | last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE. I have created a sample page, and I'm...
1
by: vindu | last post by:
hi guys i have got a problem in designing my web pages....... That the for example background-image:url('sun.jpeg'); is not working Can any one help me finding out solution for this....and give...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.