473,396 Members | 1,834 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,396 software developers and data experts.

Resize an image to work perfectly in various resolutions?

14
Does anyone know how to resize an image to still look and fit perfectl in different resolutions?
Also how to align text to the righthand corner of my header image:

http://homepage.eircom.net/~egoman/leocss1.html

Thanks,
Leo
Oct 10 '06 #1
3 2608
Say, for example you wanted to have an image which filled the whole screen without being cropped or repeated regardless of screen size:

The HTML would onyl need a div wrapper with the image inside...
Expand|Select|Wrap|Line Numbers
  1. <div id="wrapper">
  2.  
  3.    <img src="image.jpg">
  4.  
  5. </div>
And the CSS...
Expand|Select|Wrap|Line Numbers
  1. #wrapper {
  2.     width: 100%;
  3.     height: 100%;
  4. }
  5.  
  6. #wrapper img {
  7.     width: 100%;
  8.     height: 100%;
  9. }
In this example, the div wrapper is set to be 100% of the screen. The image inside is set to be 100% of the wrapper size, so as you change the screen size, the wrapper size changes as does the image inside. Obviously, you'll want to use an image to suit the largest resolution as this can be shrunk down - using a small image will look crappy when enlarged!

It's all about using percentage widths - not fixed widths. Experiment with this to get fluid layouts which look good at any resolution.

The easiest way to align your text with an image would be to put the image in the same div as the text. This will give you easy control over how they both sit together.

- Jay
Oct 11 '06 #2
le007
14
Hi Jay,
thanks for the reply buddy!
I'll give that a shot now - could you plz be more specific about aligning text either with my code or an example of yours?
Thanks,
Leo
Oct 11 '06 #3
le007
14
OR - align text to the right of other text? EG 1 part of the text is aligned to the left, the other to the right?
Oct 11 '06 #4

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

Similar topics

3
by: querypk | last post by:
Hi I would like to know how to resize an Image without using python Imaging library.
4
by: David Logan | last post by:
Hello, I am trying to open a window with a graphic in it and have the window be exactly the correct size of the image. Is there anyway to do this that will work on any browser on any OS???? ...
3
by: Z D | last post by:
Hello, BACKGROUND: ============== I've created a Windows User Control that contains an Image Control (among other controls). The user control handles the picture resize event. Whenever the...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
5
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, If I create a form in Java with controls like Panels, textboxes... when I stretch/shrink the form, all the controls can grow/shrink - along with the text contained in the textboxes. This...
1
by: Bob Alston | last post by:
I have a system where many subforms are used. Often the size of the subform had to be larger than could be displayed without scrolling. I set the height of the subform to the typical height...
2
by: Dominic Vella | last post by:
Hi, I know I seem to have the really complicated questions, but I guess that's why I'm here. This is a little verbose, only because I've been trying to crack this for a week now. Your help...
3
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own...
10
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.