avazwij avazwij - 1 year ago 54
CSS Question

what's difference between writing element properties in CSS or directly?

Displaying a DIV using CSS:

div.divBg {
background-color : red;
width : 200px;
height : 300px;

This displays what is set in CSS:

<div class = "divBg">

writing the same settings inside the DIV itself does not work:

<div background-color ="red" width = "200px" height = "300px">

please tell me what i am missing

Answer Source


<div background-color ="red" width = "200px" height = "200px">


<div style="background-color:red; width:200px;height:200px">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download