473,396 Members | 1,590 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.

img: preserve aspect ratio but width and height="%"

hello,

i want to make website with a top navigation bar and one on the left.
so by using css i define three layers and everyone of them has length attr.
in percents.

but if i want to put (square) images in e.g. the top bar, which should fill
out the whole height of the bar, it depends on the screen resolution,
wether they look like square images or rectangles.

so my question is, how do i "tell" the browser that the image should fit 10%
of the screenresolution, but the image should be displayed squared, no
matter which resolution is set.
#img{
height=10%;
width= auto;
}
does NOT work

thank you
--
Georg Goerg
Jul 23 '05 #1
2 16624
In article <41***********************@tunews.univie.ac.at>,
e0******@student.tuwien.ac.at says...
of the screenresolution,
Screenresolution is irrelevant. You mean window size.
#img{
height=10%;
width= auto;
}
does NOT work


And should not. You have = where : should be. width:auto is not needed an
might even cause problems. Might be browser depended. If this was error
made while writing, you should see why URLs are nice.

#img {width:20%} has worked on some version of Opera and some version of
IE, IIRC.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 23 '05 #2
Lauri Raittila wrote:
In article <41***********************@tunews.univie.ac.at>,
e0******@student.tuwien.ac.at says...
of the screenresolution,


Screenresolution is irrelevant. You mean window size.
#img{
height=10%;
width= auto;
}
does NOT work


And should not. You have = where : should be. width:auto is not needed an
might even cause problems. Might be browser depended. If this was error
made while writing, you should see why URLs are nice.

#img {width:20%} has worked on some version of Opera and some version of
IE, IIRC.

yeah i know, i just typed it wrong
i´ll try your solution, with just one attribute (width, height)

thanks
--
Georg Goerg
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width:...
3
by: Lasse Edsvik | last post by:
Hello I was wondering if its possible to the "width" and "height" of a text when creating a pic from text. string sometext = "bla bla"; Font font = new Font("Verdana", 18); SolidBrush sb =...
16
by: Tantale | last post by:
I used this serviec to check my webpage http://www.jmrw.com/Abroad/Barcelone/index.htm Made with Dreamweaver 8. The result is 206 errors, most of them "end tag omitted, but OMITTAG NO was...
3
by: Phil Endecott | last post by:
Dear Experts, It looks as if the HTML4 spec does not define a meaning for empty height and width attributes in an IMG element. Moz seems to ignore them, while IE7 sets the dimension to 1 pixel...
7
by: Christian Hackl | last post by:
Hi everyone, I've got a question about what makes the "img" element's width/height attributes valid HTML or XHTML. First of all, this is a rather theoretical question, but digging through the...
4
by: tswaters | last post by:
Alright, so generally I'm using document.createElement("IMG").... but, I've noticed something just recently that made me switch to "new Image()" What I'm doing is creating a photo gallery of...
5
by: enaz | last post by:
Ok, so, this is my first post, if there is any info i am leaving out please tell me this is the function: function mouseOver(c) { alert(c); <!-- just for debugging--> if (c.src ==...
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: 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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.