Inserting Images

I guess you could have a web site without any images, but most of us like to have some graphics sprinkled throughout our pages. They are a good way to add visual interest and to express ideas.

Before you start adding images to your site, you need to first pay attention to the image's physical size and also to its file size. We have all visited a site only to wait and wait and wait and then finally see that itty bitty image appear. If you right-click on that image, you will probably see that the file size is huge and the reason for your wait. So you need to have your images web ready before you add them to your site. There are numerous image editing software programs that can do this, as well as quite a few online sources.

No matter how you optimize your images, they need to be placed into your web site folder. We include an images folder in our template for this purpose.

 

Inserting an Image

Expression Web makes inserting your images very quick and easy. You go to Insert > Picture > From File. Other web editors will also have something similar.

Insert Picture From File

Locate the Image

In the dialog window that opens, you will want to navigate to the images folder and find your image, highlight it, and click Open.

Locate the Image

Check the File Path

Once your image is on the page, right click on the image and choose Picture Properties from the menu that appears. A dialog box will open. This is where you need to double-check that the image you are inserting is actually within your web folder and not from another location on your hard drive. If you see a drive letter in the file path, you are not selecting from your images folder.

Confirm the File Path

Remove the Size Attributes

Expression Web will automatically place the width and height of the image into the html coding. Because we want images that will scale themselves on smaller devices, in the same dialog box you want to click on the Appearance tab and uncheck the box next to Specify Size.

Uncheck the box next to Sppecify Size

You do not want to see the width or the height in the code:

HTML
  1. <img src="mynewcar.jpg" width="200" height="133"
  2.  alt="My New Car">

Aligning Images

On your template's typography page, we detail a lot of different ways you can aign and style your images. Want an image to float to the left of the content. No problem, there is a style for that. Want an image to appear round, or with a border or shadow? There are styles for that, too.

Hint: You can apply more than one style to an image so you can have a round image with a shadow.

Image Styles:
  1. img {border: none; max-width: 100%; box-sizing: border-box;}
  2. .img-border {border: 1px #555 solid;}
  3. .img-curved {border-radius: 6px;}
  4. .img-frame {background: #ffffff; border: 1px #aaa solid; padding: 4px;}
  5. .img-shadow {margin: 5px 0; box-shadow: 0 10px 15px -9px rgba(0, 0, 0, 0.5);}
  6. .img-round {border-radius: 50%;}
  7. .img-small {max-width: 150px; height: auto;}
  8. .img-portfolio {margin: 6px 4px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.3), 0 10px 15px -5px rgba(0, 0, 0, 0.5);}
  9. .img-left {margin: 5px 10px 0 0; float: left;}
  10. .img-left-shadow {margin: 5px 10px 0 0; float: left; box-shadow: 0 10px 15px -9px rgba(0, 0, 0, 0.5);}
  11. .img-rotate-left {margin: 20px; transform: rotate(-4deg);}
  12. .img-right {margin: 5px 0 0 10px; float: right;}
  13. .img-right-shadow {margin: 5px 0 0 10px; float: right; box-shadow: 0 10px 15px -9px rgba(0, 0, 0, 0.5);}
  14. .img-rotate-right {margin: 20px; transform: rotate(4deg);}

Images and Internet Explorer

There have been reports from users who add new images and then go to File > Preview in Browser but cannot see the new images. Others have reported that new hyperlinks do not work.

Update: This issue doesn't seem to be happening as often in IE's newer release these days, but we're leaving this information here just in case you need it.

Check your "preview" settings. Go to Site > Site Settings. In the preview tab, make sure "preview using website url" is selected. Under that, check "Use Microsoft Expression Development Server". Then, select "for all web pages".

We recommend that you also have the FireFox and Chrome browsers on your computer and preview your site in these browsers. You will notice that your new images are in place and are as they should be. (It's always a good practice to preview your web in both IE, FireFox, and other browsers as well.)