Using “srcset” for your images and more image delivery techniques

After watching a recent video posted by Google Chrome Developers on YouTube, I wanted to blog about using the “srcset” attribute in the “img” tag in your HTML code to make more web developers aware of this easy-to-use/add code that will help your website. Definitely make sure to watch the video and check out the example HTML code using “srcset” in an “img” tag all down below.

Reduce image size: use srcset to automatically choose the right image (from Google Chrome Developers YouTube channel)

So to implement the “srcset” attribute into your “img” tag all you need to do is use the HTML as in the below example.

<img src="images/default.jpg" srcset="images/default-200.jpg 200w, images/default-400.jpg 400w, images/default-600.jpg 600w">

As stated in the above video, the web browser will do all of the hard work as it will decide what image best fits on the website and if the web browser doesn’t support “srcset” then it will default to the image in the “src” attribute. Need more information about “srcset”? Then check out MDN’s documentation on responsive images.

After watching the above video, I came across another recent YouTube video that had a conference talk focused on modern image delivery techniques and what can be done to images to speed to up websites. I thought the presenter had some good informative points that all web developers should know about.

Fast and Beautiful Modern Image Delivery Techniques (from Coding Tech YouTube channel)

Free online courses and learning sites

There are a lot of free online resources, including tutorials and courses. I put together a list of websites that offer free online courses that I wanted to share with others, hoping to help others. If you know of other websites that offer free online courses, please leave a comment. These websites are geared more toward courses on technical topics and coding/programming.

Take a full page screenshot in Chrome

Here’s a quick tip that I thought would be helpful for others (and myself in case I forget in the future). I needed to take a screenshot of a website in the Chrome web browser and I remembered there was an option in the Dev Tools to do this but I couldn’t find it.

So I searched around online and found an answer, which is pretty simple and quick without having to install any extensions. Here’s what to do:

  1. Open the Dev Tools (hitting the F12 key)
  2. Press the “Ctrl”, “Shift” and “P” keys at the same time
  3. Scroll down the list and find the light purple “Screenshot” rectangles and click the one with “Capture full size screenshot”
  4. A prompt will come up asking you where to save the screenshot and you are done

My thanks go to hackernoon.com for the answer to my problem.

Where does “localStorage” save data?

I have been taking a Javascript online course and we have been using “localStorage” to create a task list app. So I was wondering where does this actual data get stored because the data can be retrieved, edited and deleted so it must get saved somewhere. Since cookies aren’t being used I assumed the data was being saved in some text file somewhere locally on my computer. I did some searching online and found the answer to my question, which I thought I should share on the blog in case it can help someone else out there.

So first, there are two types of web storage, where data is stored locally in a user’s web browser. First, local storage, where the data stored has no expiration date and will persist after the web browser is closed. Second, session storage, where the data stored gets cleared after the web browser is closed.

So the data saved using web storage is stored locally on your computer. Each web browser has their own location to store this data. Looking at Wikipedia’s web storage page, it links to a few pages on StackOverflow (here and here) where others have listed the location of the saved data.

I also wanted to link out to the w3schools.com’s page on localStorage which has a quick simple example in Javascript showing how to set and retrieve data using localStorage.

Sharing resources with you: HTML5 input types, Picular and cheatsheets

This will be a quick/short blog post with a few links to an article and helpful resources for developers.

  • HTML5 Input Types: Where Are They Now? – Blog post from SmashingMagazine.com, that talks about HTML5 form input types and shows their support in various web browsers
  • Picular – A free service to see many color variations and get their color code
  • GRID – A visual cheatsheet for CSS Grid layout
  • FLEX – A visual cheatsheet for CSS Flexbox

Sharing resources with you: Firefox extensions, shady Google and data breaches

Here are some resources from around the web I thought would be helpful for everyone.

Sharing resources with you: get a web dev job, web dev portfolio tips, a lightweight lightbox, and more

It’s been awhile since I’ve shared resources from around the web, so here we go:

Media query max-width and min-width

I wanted to write a quick blog post explaining in plain English what max-width and min-width mean when setting up media queries in your CSS, so here we go first with an example of media query code in your CSS.

Code examples of min-width and max-width

<style>
@media (min-width: 480px) { /*add your css in here*/ }

@media (max-width: 1280px) { /*add your css in here*/ }
</style>

Using the code example above, “min-width: 480px”, means that when your web browser’s viewport width is equal to or more than 480px, then the web browser will apply the CSS in the brackets that follow.

Again, using the code example above, “max-width: 1280px”, means that when your web browser’s viewport width is equal to or lesser than 1280px, then the web browser will apply the CSS in the brackets that follow.