210 likes | 353 Views
Images. 28 January 2014. Follow Ups. Corrections and Tips. Can use width on body Word spacing Centering without a width. Images. Pictures are stored as pixels. Monochrome: BLACK or WHITE. What is a Color Pixel?. Red Green and Blue Each has a value between 0 and 255.
E N D
Images 28 January 2014
Corrections and Tips • Can use width on body • Word spacing • Centering without a width
Pictures are stored as pixels Monochrome: BLACK or WHITE
What is a Color Pixel? • Red Green and Blue • Each has a value between 0 and 255
[SIDEBAR] ASCII Images • Instead of pixels, use characters
ASCII Image Web Sites ONLINE http://picascii.com/ DOWNLOAD http://photoediting.dphotojournal.com/ascii-art-generator-3242/
Many Formats • jpeg or jpg, png, tif, gif, … • Different encodings, different sizes but they all will work • But you MUST use the correct extension name and capitalization
Images in HTML • Remember that HTML is just text • Need to point to pictures • Use the img tag <imgsrc=“where” alt=“what”> • alt: for screen reader and when pictures aren’t downloading • REQUIRED for this class
Review: Viewing a Web Page SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions 2 1 3 Server Client Web Server Images Browser
Where are pictures stored? • Can be any where on the web • src has full url <imgsrc=“http://www.cs.unc.edu/cms/about-us/sittersonsmall.jpg” alt=“Sitterson”> • Problems • Pictures change or disappear • You’re poaching on their resources • NOT PERMITTED FOR THIS CLASS
Preferable: IN THE FOLDER • If you only have one or two, just another file • src just needs the file name • <imgsrc=“sittersonsmall.jpg” alt=“Sitterson”> • REMEMBER: case matters • If you have a lot, keep them in their own folder • srcneeds the path • <imgsrc=“images/sittersonsmall.jpg” alt=“Sitterson”> • BUT ALWAYS WITHIN YOUR FOLDER
Picture Sources • Your own • Publicly available • Flickr and the Creative Commons • Google and labeled for reuse
References Summary • In my folder file.ext • In a subfolder subfolder/file.ext • On the web http://www. …
What about Resizing? • Resize and crop before you put it in the folder • Why? • Size • More control • May also want to reduce quality • isis will run out of space • Use any program • Can do it on the web: phixr
Sizing Pictures • When using a SINGLE picture (not a page of photos), okay to place size in tag • Why? Typically unique • http://www.w3schools.com/tags/tag_img.asp • No other attributes allowed • Only size ONE dimension. Deductions for using both. • Borders, padding, margin, … or multiple pictures: use CSS
Adding a caption <figure> <img …> <figcaption>caption</figcaption> </figure>
Where else can images be used? • Body background • background textures • List marker
Overall page design • Default: window size • Advantage: grows and shrinks easily • Disadvantage: harder to design • Making body fixed width • Advantage: easier to control • Disadvantage: scroll bars and unused space • Using fixed width section in default body • Combines advantage of fixed width without scroll bar • Allows complex backgrounds
Background Image • Body background • Works nicely when content is overlayed • Use div or section or … • Opacity to let it show through • Background-image • Background-size • Background-repeat