How do I scale a lot of images using CSS in HTML5 and CSS3
I have a CSS image gallery that displays a larger photo with descriptive text below it, when a thumbnail image is hovered on.
Each photo has code like that following:
<a class="thumbnail" >
<img src="thumbs1/paradethumbs/DSC_0073.jpg" alt="thumbnail picture" />
<span><img src="pics1/paradepics/DSC_0073.jpg" alt=" " /><br /> 19 - a black faced sheep.</span>
</a>
The first source is a thumbnail, image stored at a size of 72 by 48.
The second source is an image stored at 600 x 400.
When the thunbnail is hovered on, the larger photo is displayed at its full size using css.
There are 20 or so thumbnails in this gallery, and different numbers in other galleries that use the same code.
The example above is number 19 from 20.
This works fine on tablets and larger displays.
When I wish to show it on an Iphone or similar, with a display that is 480 or less wide, I need to scale the larger photo down to 300 wide.
As the Iphone will have a lower quality of image than a larger display, it will not matter too much if the 600x400 photo is scaled down, and having tried it by giving it an ID with CSS like
#imagescale{ width:300px; } it looks acceptable. However, as IDs are supposed to be unique, then thats a no go area for the remaining photos.
My problem is how do I select the second image source shown in bold above, and scale it and the span text by 50%.
The text is not too important as it can be changed to fit - the image is the main problem.
I need someting like "if the display is less than 600 and the image is in the pics directory, display it at 300 wide".
The browser will hopefully take care of the height.
Any suggestiosn would be appreciated.
Howard Walker
Thanks Nancy. The general idea and the link to the article helped a lot.
However, the css using using a percentage had unpredictable results when selecting repeated images.
The first one scales to 50% and then the next scales to 50% of the last one (25%) and so on ad infinitum, unless you click on another object that is not an image.
Using a pixel size like 280px rather than a percentage did the trick, but it also involved changing lots of other items before I could get everything to fit.
Now I have a better knowledge of media queries and how to set them up.
Best of all, all my image galleries work fine just using css and html. Never thought that would happen.
Take five stars!
And the same to David Powers for his great article.
Howard Walker
Similar Messages
-
How do I add keywords to my images using DW?
How do I add keywords to my images using DW?
Well, there's <meta> keywords, then there are "keywords", here's an example...
<meta name="keywords" content="everything, you, can, pack, into, this, tag, doesn't, matter, what, or, if, it, makes, sense">
...is totally obsolete for the reason I hint at in that tag example itself. There was a time, long ago in the dark ages of web design, where the keywords meta was actually used to determine page content to some degree. Developers immediately took advantage of it and started cramming everything they could think of into the <meta>, even totally unrelated but popular search terms, in the hopes that it would affect their rankings. It did, for a time, until the search engines got smarter and started totally ignoring the tag all together.
"Keywords" changed meaning after that. Now search engines actually look at your page content and determine what your page is about. Making keyword rich, relevant html text (not odd blocks of random coma separated text anymore) is one of the things (there are many pieces to Search Engine Optimization or SEO) that determines if someone finds you using a particular word or phrase. -
Centering Images using CSS but having links on the Images
Hi all,
I have a problem on centering an image using CSS. I read on many forums that you have to use margin-left , margin-right and set to auto. and also set the display:block which I had done.
The problem is if I want to have a link from the image. Because I have set the display to block, the link will span the entire container containing it! How do I resolve that? I only want the image to be linkable and not the entire container!
Thanks for reading!Murray *ACP* wrote:
Because I have set the display to block, the link will span the entire container containing it!
That's incorrect. If the display:block is applied to only the IMAGE, the anchor tag will be exactly the same dimensions as the image and will not fill the container.
Hi Murray,
Weirdly it does in my experiments. (code below). Even if I set the 'a' tag to the width of the image it still makes the whole <div> container clickable:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
#imgWrapper {
width: 900px;
margin: 0 auto;
border: 1px solid #000;
#imgWrapper img {
margin: 0 auto;
display: block;
</style>
</head>
<body>
<div id="imgWrapper">
<a href="http://www.bbc.co.uk"><img src="slice_2.jpg" width="595" height="130" /></a></div>
</body>
</html> -
How to install html5 and css3 in my DW cs6 i cant download updates from adobe :/
how to install html5 and css3 in my DW cs6 i cant download updates from adobe :/
What do you mean you can't write HTML5 code? Are you working within an HTML5 doc type?
To make HTML5 your default doc type, go to Edit > Preferences > New Document. Click on screenshots below.
To create a new page, go to File > New > Blank page > HTML. Select none from the 3rd column. Select HTML5 doc type. Hit Create button.
Nancy O. -
I need to create a image using some numeric values and i want to display values in image,
I need to create a image using some numeric values and i want to display values in image, Numeric values be enterd by text file, excel file or user input by dialog box,
this is the sample if image.
http://s17.postimg.org/5xvtzbztn/5_01_03_I.png
128 x 16 Pixels , Back ground Black, Numbers in Red, Should be same as above picture.
Because i have hundreds of images to create like this.
If any one can make a script for this it is very good.
Sorry about my English.
Thank you.Have you checked out data driven graphics?
https://helpx.adobe.com/photoshop/using/creating-data-driven-graphics.html -
How to insert BLOB datatype image using PL/SQL Procedure and SQL Loader
Hi,
How to insert an image into database using PL/SQL Procedure and also how to insert using SQL Loader. Please help by giving sample code and process description.
Thanks,
Vijay Vhttp://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:232814159006
-
How to overlap an image using css in my .cfm
Hi, I know this is a little off-topic, but in my gallery.cfm,
I have a couple of rows that have an image in it, I was wondering
how I can use css to put some text over the image? Like for
example, how can I put some red text "Sold out" over toy1.jpg? I
have tried using z-index but that requires some positioning but in
this case there is no positions ? Can someone please help me on
this?
Sample code:
<table align="center">
<tr>
<td>
<img src="images/toy1.jpg" width="128" height="180"
border="0">
</td>
</tr>
<tr>
<td>
<img src="images/toy1.jpg" width="128" height="180"
border="0">
</td>
Thank you,
CHope this helps.
<style type="text/css">
.cell {position:relative;}
.productImage {top:0px; left:0px; width:128px; height:180px;}
.soldText {position:absolute; top:30px; left:0px;
font-size:2.0em; color:red; width:100%;
text-align:center;
font-family:impact,lucida console,verdana;
opacity:.8}
</style>
<table align="center" border="2">
<tr>
<td>
<div class="cell">
<div class="productImage"><img src="images/toy1.jpg"
width="128" height="180" border="0"></div>
<div class="soldText">Sold!</div>
</div>
</td>
</tr>
<tr>
<td><div class="cell">
<div class="productImage"><img src="images/toy1.jpg"
width="128" height="180" border="0"></div>
<div class="soldText">Sold!</div>
</div>
</td>
</tr>
</table> -
How to retain zoom position of an image using Adobe Flash Builder?
Hi,
I have created an Adobe Flash Builder Mobile App. I placed an image in the Homeview. I allow the user to zoom out or zoom in the image using GestureZoom.
The problem is each time the user zooms, it does not retain the previous position.
For ex., If I have a map image, I zoom the Bangalore area. After the zoom, I don't see the Bangalore area in the visible portion of the device screen.
Can anyone help me in this? I feel this is a very basic requirement of zoom but I am missing something really.
I have seen few samples of this requirement in Adobe Flash which does not work for mobile apps.I don't understand what you mean, but to give you a sample file so you can see what I am talking about:
link to fla file: http://dl.dropbox.com/u/48932382/Untitled-1.fla
link to swf file: http://dl.dropbox.com/u/48932382/Untitled-1.swf
As you can see in this file, I am turning the green page, but when you should be seeing behind the page, it's actually transparent and you end up seeing the page underneath it.
Here is a picture of it: (if your wondering, the pages have the same text, it's just the color of the pages are different) -
Resizing image using CSS - not working in IE
Hello,
I have a standard report with couple of columns one of which a image column. The images are of varying sizes and I manged to resize them to a fixed width & height by using CSS code in page header as below:
td[headers="ITEM_PICTURE"] img {
display: block;
width: 70px;
border: 1px solid #999;
padding: 4px;
background: #f6f6f6;
}The CSS does the trick in Chrome & Firefox but does not work in internet explorer. Is there a way to make this CSS code IE friendly?
Cheers for help.William Wallace wrote:
I am using Apex 4.2.1 (had this issue in 4.1.1 as well) and using theme 10.Ah, the Sludge Sand theme. In 4.x that's a legacy theme only really included to allow applications to run on IE6. It's therefore intended to run in quirks mode, meaning in Internet Explorer terms there's no support for anything that didn't work in IE6 (for certain values of "work"). This means no CSS3, no support for a lot of useful CSS2.1 stuff (like attribute selectors), and probably problems with jQuery which requires standards mode. Adding a DOCTYPE to the page templates to trigger standards mode Interactive Report: how can I display carriage returns?. In 4.2 you really should switch to one of the latest Standard themes, or at least one of the standards mode Legacy themes (those not marked with a "*").
If you must use theme 10, and there are no other images in this report (like edit icons) then you could add a static ID to the region and use a more basic selector like:
#static-id td.t10data img {
display: block;
width: 70px;
border: 1px solid #999;
padding: 4px;
background: #f6f6f6;
}However, it appears that one of IE's quirkier quirks mode quirks is that CSS padding is not supported on images, so the presentation you want is not possible using theme 10 in IE and CSS alone.
Switching to a modern theme is recommended.
Edited by: fac586 on 02-Mar-2013 10:31 -
Hello,
GeoIPTC is an innovative tool to add geographical identification to your images (geocoding) according to IPTC and XMP metadata embedded in images.
GeoIPTC reads all IPTC and IPTC Core metadata embedded in an image, isolates localisation data (City, Location, Province/State, Country Code and Country Name), then sends a request to a Geocoding Web Service and finally gets latitude/longitude coordinates.
To say it briefly: GeoIPTC gets geographical information from the postman address embedded in image.
Main features
* Gets full sets of image standard metadata
* Automatically gets longitude/latitude from widely used Geocoding Web Services like Google Maps, Yahoo! Maps or GeoNames.
* Locate automatically images on Maps Services like Google Maps, Yahoo! Maps and MapQuest
* Generate automatically KML or KMZ placemarks and locate single (one image) or multiple (many images) placemarks on Google Earth with full IPTC/IPTC Core metadata
* Set automatically single or multiple images with appropriate Exif GPS coordinates
More information and download:
http://www.geoiptc.com/EN/Index.html
With best regards
Patrick Peccatte
www.softexperience.comNote the last paragraph in the original post which explains how Flickr handles resolution changes without breaking the rectangles. Perhaps a more straightforward approach would be to store both the rectangle coordinates for each rectangle AND the image's width and height at the time the rectangles were created. Then if the image is scaled, the rectangles can be scaled accordingly. For example, if a rectangle is at x=100,y=200,w=50,h=70, the "original dimensions" are 1000x2000, and the image's current dimensions are 500x1000, then an application could assume the image has been scaled down by (500/1000=) 0.50, and so the x,y,w,h of each rectangle could also be multiplied by 0.50 (x=50,y=100,w=25,h=35). I'd recommend storing floating-point values so that multiple scalings don't make the rectangles "creep".
Of course, it is possible that really the image was cropped rather than scaled, but fairly unlikely you would happen to crop it the same percent in both directions. Even if an image is cropped, someone could manually repair the rectangles by sliding and scaling them until the fit back on the faces (unless most of the faces were cropped off).
A rectangle-aware application could scale and translate the rectangles during a crop or scaling operation, but other applications could still survive scaling if they at least preserve the XMP tags as-is. -
How to find out where a query is used in a FMS and or Form?
Hi Experts,
How can I find out quickly where a query is used in which fms and / or form?
thx,
RichardHi Richard,
Try this:
SELECT T2.FormID, T2.ItemID, T2.ColID,
T1.CatName,T0.Qname FROM [dbo].[OUQR] T0
INNER JOIN [dbo].[OQCN] T1 ON T0.QCategory = T1.CategoryId
INNER JOIN [dbo].[CSHS] T2 ON T2.QueryId = T0.IntrnalKey
ORDER BY T2.FormID
Thanks,
Gordon -
How to manage a "nice" url if APEX uses web pl/sql and not Apache?
Hi all,
How can I create a pretty url without using redirects or frames since APEX is using web pl/sql and not Apache? This is on version 4.0.1. We want the users to access the Apex App from a nice url without the traditional long url.
Thanks,
Veena.How can I create a pretty url without using redirects or frames since APEX is using web pl/sql and not Apache? This is on version 4.0.1. We want the users to access the Apex App from a nice url without the traditional long url.Hi,
check out the last part of this blog post:
http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html
- Morten
http://ora-00001.blogspot.com -
How to style a GridPane Colomn or row using CSS ?
Hi,
I would like to style a Grid pane column using CSS. I found possible styling the entire GridPane using " -fx-border-color:yellow; -fx-border-insets:5; -fx-border-width:3;" for example. But is there a way of styling a single row or a single column?
For example, let's say I want a yellow border on my last column, does anyone has a clue ?
Thanks.
SebCSS doesn't do such things.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"celebritymusic" <[email protected]> wrote
in message
news:esm5vt$8mn$[email protected]..
> Hi
>
> I want to make an image in a DIV morph into another (in
the same DIV). I
> was wondering if there is a simple CSS way of doing
this, rather than
> making an animated gif?
>
> Cheers
>
> Shaun -
Can any one tell me the exact procedure of how to update XPERIA NEO V using both PC companion and SUS.
Please provide required link also for SUS and step by step procedure for the same.
It will be really helpful.SUS http://www.sonymobile.com/global-en/tools/update-service/
You just need to connect your mobile to pc companion follow the onscreen instructions
Use pc companion
http://www.sonymobile.com/global-en/tools/pc-companion/
Discussion guidelines.
Message me or any other moderator to seek help regarding moderation. -
How do I scale square frames in CS5 using applescript?
I need help fixing a script which changes the scale of square frames after it duplicates them. The script worked fine in CS1 but not for CS5. I tried changing "resize" to "scale" but it doesn't compile correctly. Does anyone know how to change "resize mySelection01 horizontal scale 21.6 vertical scale 21.6" to work for CS5?
Thanks,
Hector
tell application "Adobe InDesign CS5.5"
set myDocument to active document
tell myDocument
set startinglayer to "Image"
tell page 2 of myDocument
set mySelection01 to rectangle 1
duplicate mySelection01
resize mySelection01 horizontal scale 21.6 vertical scale 21.6
move mySelection01 to page 28 of myDocument
move mySelection01 to {15, 55}
set properties of mySelection01 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 4 of myDocument
set mySelection02 to rectangle 1
duplicate mySelection02
resize mySelection02 horizontal scale 21.6 vertical scale 21.6
move mySelection02 to page 28 of myDocument
move mySelection02 to {116, 55}
set properties of mySelection02 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 6 of myDocument
set mySelection03 to rectangle 1
duplicate mySelection03
resize mySelection03 horizontal scale 21.6 vertical scale 21.6
move mySelection03 to page 28 of myDocument
move mySelection03 to {218, 55}
set properties of mySelection03 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 8 of myDocument
set mySelection04 to rectangle 1
duplicate mySelection04
resize mySelection04 horizontal scale 21.6 vertical scale 21.6
move mySelection04 to page 28 of myDocument
move mySelection04 to {319, 55}
set properties of mySelection04 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 10 of myDocument
set mySelection05 to rectangle 1
duplicate mySelection05
resize mySelection05 horizontal scale 21.6 vertical scale 21.6
move mySelection05 to page 28 of myDocument
move mySelection05 to {15, 157}
set properties of mySelection05 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 12 of myDocument
set mySelection06 to rectangle 1
duplicate mySelection06
resize mySelection06 horizontal scale 21.6 vertical scale 21.6
move mySelection06 to page 28 of myDocument
move mySelection06 to {116, 157}
set properties of mySelection06 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 14 of myDocument
set mySelection07 to rectangle 1
duplicate mySelection07
resize mySelection07 horizontal scale 21.6 vertical scale 21.6
move mySelection07 to page 28 of myDocument
move mySelection07 to {218, 157}
set properties of mySelection07 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 16 of myDocument
set mySelection08 to rectangle 1
duplicate mySelection08
resize mySelection08 horizontal scale 21.6 vertical scale 21.6
move mySelection08 to page 28 of myDocument
move mySelection08 to {319, 157}
set properties of mySelection08 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 18 of myDocument
set mySelection09 to rectangle 1
duplicate mySelection09
resize mySelection09 horizontal scale 21.6 vertical scale 21.6
move mySelection09 to page 28 of myDocument
move mySelection09 to {15, 258}
set properties of mySelection09 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 20 of myDocument
set mySelection10 to rectangle 1
duplicate mySelection10
resize mySelection10 horizontal scale 21.6 vertical scale 21.6
move mySelection10 to page 28 of myDocument
move mySelection10 to {116, 258}
set properties of mySelection10 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 22 of myDocument
set mySelection11 to rectangle 1
duplicate mySelection11
resize mySelection11 horizontal scale 21.6 vertical scale 21.6
move mySelection11 to page 28 of myDocument
move mySelection11 to {218, 258}
set properties of mySelection11 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
tell page 24 of myDocument
set mySelection12 to rectangle 1
duplicate mySelection12
resize mySelection12 horizontal scale 21.6 vertical scale 21.6
move mySelection12 to page 28 of myDocument
move mySelection12 to {319, 258}
set properties of mySelection12 to {fill color:swatch "None" of myDocument, stroke color:swatch "Black" of myDocument, stroke type:stroke style "Solid" of myDocument, stroke weight:0.25}
end tell
end tell
end tellHector, I would have gone the route of transforming the rectangle myself… but matrix is a little tricky to get the lingo right… Only done it in ExtendScript before now… Any how this should give you the general idea of the loop… Your X&Y values are not equidistant so I went for a list instead…
tell application "Adobe InDesign CS5"
tell the active document
set dupPage to page 28
-- Loop the 12 items
repeat with i from 1 to 12
-- A list of 12 X&Y pair lists
set posBox to {{15, 55}, {116, 55}, {218, 55}, {319, 55}, ¬
{15, 157}, {116, 157}, {218, 157}, {319, 157}, ¬
{15, 258}, {116, 258}, {218, 258}, {319, 258}}
-- Double the value of i for the page ref
tell page (i * 2)
set dupeBox to duplicate rectangle 1
-- Transform the matrix here
-- or use your property value change…
move dupeBox to dupPage
move dupeBox to item i of posBox
set fill color of dupeBox to "None"
set stroke color of dupeBox to "Black"
set stroke type of dupeBox to "Solid"
set stroke weight of dupeBox to 0.25
end tell
end repeat
end tell
end tell
Maybe you are looking for
-
Why can't I replace missing fonts with my desktop fonts?
I just updated to CC 2014 which implemented the new Typekit features. Now "Find Font" is "Resolve missing fonts..." which only allows missing fonts to be replaced with Typekit fonts or other fonts already found in the document. Am I the only one who
-
My iTunes is unresponsive when I connect my iPhone and iPad. It freezes and the coloured disc keeps spinning.
-
Turn off auto-correction in 2.0?
Is there a way to turn off auto-correction in firmware 2.0? I live in a non-English speaking country and most of my typing is in non-English. It's really annoying when my iPod tries to correct every other word that I type.
-
Need query to determine current logged in user
Because I see no way in sccm 2012 to determine if someone is currently logged into a domain joined computer. Does anyone have a query or know of a way to get the current logged in user of a computer? I am surprised that SCCM does not show that infor
-
I have iPad 2 since yesterday I can't open the videos , any one know why?!
I can't open my videos anybody knows why