Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

How to Make Images Responsive

Normally images on a webpage have a have a fixed width and height. But with today's widespread use of mobile devices, you might want to use a little easy style code to make them adjust their size if your webpage is displayed on a small mobile smartphone screen.

Google's mobile-friendliness design tester

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<style>
img
{
width: 100% ;
height: auto;
}
</style>

<title></title>
</head>
<body>

<img src="hibiscus.jpg" />

</body>
</html>

The code shown above creates a webpage that reduces or increase the image's width to be the same width as the webpage, and reduces or increase the image's height the same proportion.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<style>
#half
{
float: right;
width: 50%;
height: auto;
}
</style>

<title></title>
</head>
<body>

<img id="half" src="hibiscus.jpg" />

</body>
</html>

The code shown above creates a webpage that reduces or increase the image's width to be half the width as the webpage, and reduces or increase the image's height the same proportion. By default the image would end up on the left side of the page, but the style float: right; causes it to be on the right side of the page.

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro


Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268