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
-
Cost-Benefit Analysis of Cloud Computing versus Desktop Grids Derrick Kondo1, Bahman Javadi1, Paul Malecot1, Franck Cappello1, David P. Ander...
-
When considering the profound artistic explication of nature in Eastern tea ware and interrelated literati drinking vessels, one can find m...
-
Today in this tutorial we are going to teach you that how to apply conditional styling in Internet Explorer and what are some reasons to use...
-
For the recent music video for hip dubstep-rock act Nero’s first chart hit, Me & You, James May – aka Smudgethis – created a fictional ...
-
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 ...
-
Long-lasting traditions from some cultures span generations. Perhaps others are shorter lived, but either way there is value to staying conn...
-
When the time came for me to embark on a new career, I made the decision to try something that was totally new and different. That was the b...
-
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...
-
Maybe you have some uncommon way of dealing with an everyday problem, or you've developed a faster or cheaper way of doing something. Ei...
-
Well, if you look challenging enough in bookshops, libraries and search about online, you might obtain varied bits of specifics right here a...
0 comments:
Post a Comment