Step 1 – Create basic html document
In the above screenshot you will see the basic HTML5 document.
- Where I have HTML5 declaration at line #1
- HTML root element at line #02
- Head tag at line #03
- And body tag at line #05
Step 2 – Add a paragraph tag and text
In the above screenshot, on line #06 you will see I have added an id attribute with the value “my-paragraph”.
And finally on line #09 I have added a console.log method to show you the element that I have got by rendering in the web browser.
Let’s render the webpage and see the element which we got in the browser console tab.
In the above screenshot you can see the rendered text on screen and when you press “CTRL+SHIFT+i” on windows the developer tools tab will be opened.
From there select the console tab and you will see a paragraph element printed in console window, as above red bordered text in picture.
Let’s render this code in our web browser to see the changes.
In the above screenshot you will see that our paragraph text is now red. And from developers tools, click on the “Elements” tab and you will see an inline style attribute added with the property “color” and value “red”.
You may also like: