Explain what going to a website does and what is displayed. What elements are and a little bit about structure. Along with HTML file comes a set of styles - CSS Styles manipulate the HTML by selecting the tag, class, id
- https://en.wikipedia.org/wiki/Main_Page
- Click
Random Article
- Play revisionist History
- Change the text to your liking
- Delete elements that you don't like
- Find Heading text elements
- Change Heading CSS in the right panel according to the class name
- Class
firstHeading
- Class
- Navigate to https://thehivetaipei.com
- Right click on some text. Pick
Inspect
orInspect Element
- In the
Elements
tab double click on the text for the element (usually it's<h1/> <p/> <span/> <a/>
) and say whatever you'd like - On the righthand side you can change the style of the text you added by adding a style to the
element.style
box.- Try using a word for the color (eg
orange green blueviolet
) - Try using a Hex value (eg
#213B33 #0399F9
) - https://htmlcolorcodes.com/color-picker/
- Try using a word for the color (eg
- Manipulate the
font-size
attribute to make the text larger/smaller - Right click on an any element in the
Elements
tab and selectDelete Element
<script>
tags in HTML
Interactivity while website is running
Attach listeners, timers, request more data
- https://www.pokemon.com/us/pokedex/
- Right click. Pick
Inspect
orInspect Element
- In the
Console
tab enterimageSection = document.getElementsByClassName("pokedex-results")[0];
- These elements will come back as an "array" type. Arrays are like lists. Counting starts at zero for arrays. And since there's just one, we'll select the first one.
- Next you can get all the images by entering
pokeImages = imageSection.getElementsByTagName("img")
- Now we have an array (list) of images.
- Now you can pick any of the images and give them a new width. Try
pokeImages[2].style.width = "15px"
- Navigate to https://www.taiwannews.com.tw/en/index
- Scroll down to
Hot News
section - usingscrollTo
- Right click one of the thumbnails. Pick
Inspect
orInspect Element
- Notice the class of the thumbnails has
entry-image
andhas-image
- You might have to dig down opening arrows on the left side to get down to the image to see it.
- Select all the thumbnails and set them to a variable
images = document.getElementsByClassName("entry-image")
- Try increasing and decreasing the sizes of the various images by selecting them in the array and changing
width
andheight
images[1].style.width = "15px"
images[2].style.height = "1200px"
- Try on any website
- Some images are harder to figure out how to manipulate due to more complexity in the site's css
- Try different elements and different attributes - https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference