There is one problem here, and that is that the image may be too wide. In this case, the image is always 136 px wide and the DIV is 30% of the surrounding text. So if you make the window narrower, it may be that the image overflows the DIV (try it!). Saint Tropez and its
If you know the width of all images in the document, you can add a minimum width to the DIV, like this:
DIV.figure {
min-width: 150px;
}
Another way is to scale the image itself. That's what we have done with the image on the right here. As you can maybe see if you make the window very wide, JPEG images don't scale very well. But if the image is a diagram or a graph in SVG format, scaling in fact works beautifully. Here is the mark-up we used:

fort in the evening sun
St. Tropez
Saint Tropez and its fort in the evening sun
And this is the style sheet:
div.figure {
float: right;
width: 30%;
border: thin silver solid;
margin: 0.5em;
padding: 0.5em;
}
div.figure p {
text-align: center;
font-style: italic;
font-size: smaller;
text-indent: 0;
}
img.scaled {
width: 100%;
}
The only addition is the last rule: it makes the image as wide as the inside of the DIV (the area inside the border and the padding)
Labels:
Information,
life style,
Tutorials
Scaling the image
Rama
Sunday, May 29, 2011
Subscribe to:
Post Comments (Atom)
Popular Posts
-
by: SINGER. Cloud computing can be defined as a data service, software and storage service, where the end user is not aware of the physical ...
-
Ari Saputra - detikNews Jakarta - Seni mural atau lukisan di dinding jalanan semakin marak di Jakarta. Kebanyakan menghiasi pilar beton j...
-
For the recent music video for hip dubstep-rock act Nero’s first chart hit, Me & You, James May – aka Smudgethis – created a fictional ...
-
Well, if you look challenging enough in bookshops, libraries and search about online, you might obtain varied bits of specifics right here a...
-
Dalam bekerja dengan judul game lucu di internet, karakteristik akan hampir selalu menjadi pertimbangan para gamer tentang atas '. Merek...
-
Jika Anda seorang pemilik bisnis online Anda mungkin memahami bahwa kemampuan Anda untuk menyampaikan informasi kepada prospek Anda dan pela...
-
There are 3 kinds of Networks / Network are: a. Local Area Network (LAN) / Local Area Network. A LAN is a network that is limited by a re...
-
HTML doesn't have an element that allows to insert a figure with a caption. It was once proposed (see HTML3), but never made it into HTM...
-
6 years ago I was exactly like you: I was reading a lot about technical analysis and was utterly fascinated about it. The idea of making mon...
-
In this tutorial I’m going to teach you how to construct a simple UI slider using jQuery. It’s very effective and can be used for almost any...
0 comments:
Post a Comment