20
CLASS NOTES 1 CLASS :: 12 05.04 2018 3 Hours AGENDA CREATE A WORKS PAGE [ HTML ] :: Open index.html :: Save As… works.html :: Edit works.html to modify header, 3 divisions for works, then add your content :: Edit index.html to have proper hypertext references to your works :: Test hyperlinks in your browser EMBEDDING FONTS [ Font Files & CSS font-family ] :: Online Font Converter :: ADD font-family css code to style.css RESPONSIVE WEB DESIGN [ CSS ] :: Viewport & Basic Syntax for Devices :: ADD rwd.css code to the end of your existing style.css document UPLOAD FILES To SERVER

AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

1

CLASS :: 12

05.04

2018 3 Hours

AGENDA CREATE A WORKS PAGE [ HTML ] :: Open index.html :: Save As… works.html :: Edit works.html to modify header, 3 divisions for works, then add your content :: Edit index.html to have proper hypertext references to your works :: Test hyperlinks in your browser EMBEDDING FONTS [ Font Files & CSS font-family ] :: Online Font Converter :: ADD font-family css code to style.css RESPONSIVE WEB DESIGN [ CSS ] :: Viewport & Basic Syntax for Devices :: ADD rwd.css code to the end of your existing style.css document UPLOAD FILES To SERVER

Page 2: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

2

CREATE A works.html PAGE [ HTML ] :: Open index.html and Save As… works.html :: Edit <header> element [ Add class name as shown ]:

:: Edit navigation menu [ Edit Hyperlinks ]:

NOTE: If you wish for the works link to take you back to the homepage works thumbnails you may edit the hyperlink to appear as <a href=”index.html#works”>works</a>. If you wish for the contact link to take you to the bottom of the same page, you may edit the hyperlink to appear as <a href=”#contact”>contact</a>

:: Edit 1st <section> element [ Add class name ]:

Page 3: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

3

:: EXAMPLE OF SINGLE LARGE IMAGE WITH TITLE & CAPTION

1. DELETE <figure> elements

NOTE: [ID names will match the works.html#hyperlinks of the view more buttons (located on your homepage)]. Above are coded example images. Replace the example image paths with your own images

2. CHANGE <div class=”wrapper”> to <div id=”works1”> 3. ADD <img> element tags 4. DELETE <a> element tags 5. EDIT <figcaption> to include details of the image shown

Page 4: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

4

:: EXAMPLE OF YOUTUBE EMBEDDED VIDEO, TITLE, & CAPTION

1. DELETE <figure> element tags 2. CHANGE <div class=”wrapper”> with <div id=”worksnumber”> tag 3. ADD Embed code (for Vimeo/YouTube), or Original video source code 4. DELETE <a> element tags

Page 5: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

5

:: SERIES OF THUMBNAIL IMAGES WITH HYPERLINKS TO A LARGER IMAGE

1. DELETE <figure> element tags 2. CHANGE <div class=”wrapper”> with <div id=”worksnumber”> tag 3. ADD <a> [hyperlink] & <img> [thumbnail] elements 4. DELETE <h2> & <figcaption> elements

Page 6: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

6

:: SERIES OF ELEMENTS CONTAINING THUMBNAIL IMAGES, TITLE, & CAPTION

1. Replace <figure> element tags with <div> tag, plus class name

:: Select the entire <section id=”about”> element [ DELETE ENTIRE ELEMENT ]

Page 7: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

7

EDIT index.html PAGE :: Edit Hyperlinks to your “view more” buttons (IF NEEDED)

[ This will link your view more buttons to named anchors on your work.html page ]

NOTE: Class example images are coded above. Use your own image paths

TEST IN BROWSER :: Preview your site in Google Chrome :: Test all of your hyperlinks…

Page 8: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

8

CSS QUIZ-ISH :: How do you select an element without an id or class name? :: How do you select an element with an id name? :: How do you select an element without a class name? Style the following: HTML ELEMENT

works.html CSS STYLE PROPERTY/VALUE

style.css

1 <header class=”works-page-header”> ADD selector for HTML Element

ADD background image Edit the height [Optional]

2 <section class=”works-page-section”> ADD selector for HTML Element

Change the height to auto Edit the background color [Optional]

SINGLE LARGE IMAGE stylesheet SET-UP

3 <div id=”works1”>

ADD selector for HTML Element

ADD 5% padding Align text to the center

4 <div id=”works1”><img>

ADD selector for HTML Element Make width of images 90% or less of browser window

5 <div id=”works1”><h2> ADD selector for HTML Element

Change font-size to 3em or less [Optional] Change font color [Optional]

6 <div id=”works1”><figcaption>

ADD selector for HTML Element Change font-size to 2em or less [Optional]

Change width to 90% or less Change margin [ make sure left and right margins will equal

100% when added to the width. i.e. if you have a width of 100% the left margin should =5%, and the right margin

should = 5% --- margin:10px 5% 0 5% --- ]

Page 9: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

9

VIDEO, TITLE, & CAPTION stylesheet SET-UP

7 Repeat the same steps for <div id=”works2”>

SERIES OF IMAGES with HYPERLINKS stylesheet SET-UP

8 <div id=”works3”> ADD selector for HTML Element

Align text to the center ADD padding: top&bottom 7%, left&right 0

Edit background color [Optional]

SERIES OF IMAGES with HYPERLINKS stylesheet SET-UP

9 <div class=”image-container”>

ADD selector for HTML Element Float the elements left

Adjust the width to accommodate the number of elments you wish to line up in a row. Keep in minde you’re your

browser is 100%... if you wish to have 4 elements in a row the width of each floating element would be 25 minus the

amount of left and right padding. i.e. width:23%; padding:7% 1% 0 1%;

10 <div class=”image-container”><img> ADD selector for HTML Element Ensure the maximum width is 100%

11 <div class=”image-container”><h2> ADD selector for HTML Element Align text to the center

12 <div class=”image-container”><figcaption> ADD selector for HTML Element Justify text [Optional]

UPLOAD TO IRIS

Page 10: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

10

:: Define Your Site At Home [Page 1-3] + [Page 7]

URL: http://iris.nyit.edu/~dmyrick/DGIM601-W01/docs/defining-a-website.pdf :: Upload Site or Files to Your Iris Server Space

URL: http://iris.nyit.edu/~dmyrick/DGIM601-W01/docs/dw_upload-files.pdf

Page 11: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

11

CHANGING YOUR WEBSITE’s FONT w/ WEB SAFE FONTS

:: To change your entire website’s font, you will go to your style.css document and type in the selector for the body element. Inside of the curly brackets, you will add the font-family property, then choose a web-safe font from the drop-down menu.

body { font-family : “Proper font name”, “sans-serif”; }

SEE LIST OF WEB SAFE FONTS: https://www.w3schools.com/cssref/css_websafe_fonts.asp

EMBEDDING CUSTOM FONTS

:: Embed Fonts & Style Text

If you wish to have a non-default web font for your website, you may follow these steps::

1. Go to dafont.com or fontsquirrel.com 2. Install the font on your local machine [ How to Install Fonts on Mac & PC ] 3. Go to https://onlinefontconverter.com/ 4. Click font-face, then choose SELECT FONT(S):

5. Click “Choose Files” Button 6. Navigate to your Downloads, Desktop, or System Fonts Folder [Font Book] 7. Select all versions [regular, bold, italic] of the font you will use

Page 12: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

12

8. In the lower left corner of the pop-up window, double-click the file(s) icon

(the icon at the BOTTOM LEFT will show number of files you selected (“3 files selected”):

9. Your fonts should appear in the drop zone:

@fontface is a set of css style rules that will allow you to use the font of your choice when referenced in HTML & CSS. (SEE EXAMPLE BELOW)

10. Click “Done”

11. Choose “SAVE YOUR FONTS”

12. Click My Device [In the Left Column], then the “Download All Attachments” Button:

13. Extract or Double-Click your .zip file, then open the extracted file

Page 13: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

13

14. Open the converted-files folder then select all the files:

15. Copy and Paste the files into your public_html folder 16. In Dreamweaver, Open font.css 17. Copy Code from font.css and paste into your style.css file [at the top of the document ] 18. See Next page for assigning fonts to your webpage

HTML CODE CSS CODE

HOW TO ASSIGN FONT FAMILY TO ELEMENT 1. Save the newly edited style.css 2. The code below will ensure your font displays in multiple browsers and

platforms

PASTE CSS CODE

<body> <p> A bunch of text </p> <h1>GALLERY</h1> </body>

body{font-family: ”Antonio-Bold”, sans-serif; font-size:1em;} h1{font-family: ”Antonio-Bold”, sans-serif; font-size:35px;}

NOTE: You you downloaded different versions of the font, you will have to repeat the process…

Page 14: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

14

RESPONSIVE WEB DESIGN

REFERENCES: Viewport URL:: http://www.w3schools.com/css/css_rwd_viewport.asp Standard Device List [ for queries ] URL:: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/

LECTURE/DEMO: SETTING UP THE FIRST QUERY: @media only screen and (min-width: 300px) and (max-width: 768px) { } Above is a CSS [ media query ] selector set-up for applying styles to devices between 300px and 768 pixels wide. RULES FOR QUERIES:

1. Queries are used to change the property values of pre-existing styles (to correctly display in smaller/larger devices than originally coded)

2. Media Queries are placed at the end of your existing css document 3. You may add as many queries as you wish and change the min-width & max-width values (based on devices) 4. The new style rules must be placed between the opening { and closing } curly braces

In this class, we will be testing your site with the set-up in the images to follow; however, you may add an orientation to the query (i.e. portrait or landscape) to further influence your site’s look, and target the device width exclusively:

FOR DEVICE WIDTHS BETWEEN 300px – 768px PORTRAIT LANDSCAPE

@media only screen and (min-device-width: 300px) and (max-device-width: 768px) and (orientation: portrait) {

/*ADD NEW STYLE RULES HERE*/ }

@media only screen and (min-device-width: 300px) and (max-device-width: 768px) and (orientation: landscape) {

/*ADD NEW STYLE RULES HERE*/ }

Page 15: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

15

DOWNLOAD ASSETS [ CSS ] :: Media Query ADD HTML META TAG & IE SCRIPT [ HTML ] :: Add Meta Tag for Viewport (inside of head element):

<meta name="viewport" content="width=device-width, initial-scale=1.0"> :: Add Script that renders HTML5 elements for older versions of Internet Explorer

<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->

ADD & EDIT MEDIA QUERIES [ CSS ] :: Open rwd.css: http://iris.nyit.edu/~dmyrick/DGIM601-W01/docs/rwd.css :: Copy all of the code :: Paste into your existing style.css document [ at The END of the style.css document]

Page 16: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

16

For PHONES & HANDHELDS [ portrait ] Styles for the header, nav, & logo element ::

Styles for Works Section ::

Styles for About/Bio Section ::

Styles for Footer ::

Styles for Works Page ::

Page 17: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

17

Media Query Selector For PHONES & HANDHELDS [ landscape ]

@media only screen and (min-device-width: 300px) and (max-device-width: 768px) and (orientation: landscape) {

/*ADD NEW STYLE RULES HERE*/ }

Page 18: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

18

Media Query Selector For iPad (landscape mode) @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {

/*ADD NEW STYLE RULES HERE*/ }

NOTE: You may also create a query for portrait and landscape mode for iPads. Test first to see if you wish to add those options…

For Laptops

EDIT STYLE DECLARATIONS selector { property:value; } TO YOUR LIKING

TEST IN BROWSER UPLOAD ALL FILES TO IRIS TEST ON HANDHELD DEVICE [ Phones/iPads/etc. ]

Page 19: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

19

OPTIMIZE WEB IMAGES Lessen your page load time by optimizing your images…

In Dreamweaver:

1. Go to Your File Panel 2. Open your images folder 3. Right-Click > the image to optimize 4. Choose Open With Adobe Photoshop CC 2017.app

5. In Photoshop, Go to the Menu Bar > File > Export > Save For Web (Legacy)…

6. In the pop-up panel, ensure you choose the same file type [ .jpg, .png, .gif ] as the original image in your site

7. You may lessen the quality if your file size is humongous [ NOTE: Don’t confuse File Size with Image Size… ]

8. Choose Save > Replace the existing File > Close Photoshop

9. In Dreamweaver, refresh the file panel and view the new file size…

Page 20: AGENDA - New York Institute of Technologyiris.nyit.edu/~dmyrick/DGIM601-M01/docs/dgim601_class12.pdf · @media only screen and (min-width: 300px) and (max-width: 768px) { } Above

CLASS NOTES

20

Homework HW-12

DUE :: 05.11

REVIEW ::

1. Class Notes

DO ::

• Ensure your webpage displays correctly • Ensure your images are sized correctly • Ensure your code is error free • Ensure all of your buttons are hyperlinked to the correct location • Test and adjust @medias queries to ensure your site display well on

laptop & mobile devices

SEEHOMEWORKPAGEFORCOMPLETEDETAILS

BRING :: HW-12

1 index.html

2 style.css