Using more than one CSS property

Using more than one CSS property : You can use more than one CSS property and value in a style attribute. All you have to do is use a semi-colon (;) to separate them.

Your browser will read all of the CSS properties and Here we’ve used two CSS properties apply them to your HTML element, so you can use as many as you need.

 <div style="background-color: lightblue; float: right;">
 Hello world. We have used two CSS properties.

Sample output of above code:

Hello world. We have used two CSS properties.



The code Explained:


<!--Here we’ve used two CSS properties-->

Above code snippet is an HTML comment code and does not get processed, it is used for documentation of code.

Look at how we can change both the background colour and position of a

< div >!

Related Posts:

How to make a Go-Back Input button with inline JavaScript



Connected through code, Choose Your Platform!

About the Author: Bernard Aybout

In the land of bytes and bits, a father of three sits, With a heart for tech and coding kits, in IT he never quits. At Magna's door, he took his stance, in Canada's wide expanse, At Karmax Heavy Stamping - Cosma's dance, he gave his career a chance. With a passion deep for teaching code, to the young minds he showed, The path where digital seeds are sowed, in critical thinking mode. But alas, not all was bright and fair, at Magna's lair, oh despair, Harassment, intimidation, a chilling air, made the workplace hard to bear. Management's maze and morale's dip, made our hero's spirit flip, In a demoralizing grip, his well-being began to slip. So he bid adieu to Magna's scene, from the division not so serene, Yet in tech, his interest keen, continues to inspire and convene.