Read this if you need to understand HTML elements and attributes

    <CatPhotoApp>Hello World</CatPhotoApp>

Hello newbies! If your solution to Step 1 of the “Learn HTML by Building a Cat Photo App” is not working and it looks like the above line of code, then you’ve come to the right place!



Are you confused about attributes? This post is for you…


In Summary:
HTML attributes are usually key-value pairs that provide additional information to the browser about the HTML element they are defined within.
For eg. The src attribute tells the browser the location in which an img element’s image is to be found.
The type attribute of an input element tells the browser what type of input field to create.
The class attribute identifies the HTML elements it belongs to as belonging to a specific grouping or class such that they can all be handled as a group in the CSS.

These are all examples of attributes.
All attributes are created within the opening tag of their respective elements.

They usually take the form of


(That is why they are called key-value pairs)

You can also specify more than one attribute in the same tag.
Simply add the attribute statements with one space between each statement. For eg below the anchor element has two attributes.

<a href=“some website URL” target=“_blank”>Click it!</a>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.