+ 10
How can I make background color by using <div> </div> ??? 😕😕
How can I make background color by using <div> </div> attribute ? I hope someone ask this question ...
9 odpowiedzi
+ 9
with css you can make.
-----------------------------------------
div {
width:100px;
height:50px;
background-color:blue;
}
-----------------------------------------
that's it...
+ 23
Use css
div{
background-color:red;
}
or use inline style
<div style="background-color:red;"></div>
+ 20
Don't use bgcolor. It's old HTML4 which is not used now and is deprecated.
+ 12
Use css
div{
background-color:red;
}
or use inline style
<div style="background-color:red;"></div>
+ 3
It's better having that div with a class so not all divs are colored.
You may use:
<div class="red_background">Hi!</div>
and then a css style to use it elsewhere:
.red_background{
background-color:#f00; //or red
}
+ 2
<div bgcolor="blue(or a color of your choice)" > </div>
+ 2
ok
+ 2
with css
<style>
.me{
background-color:tomato;
}
</style>
</head>
<body>
<div class="me">
</div>
</body>
+ 1
bgcolor ="red"