+ 1

Can anyone please tell me how to change the background colour in html ???

5th Jun 2017, 10:50 AM
S.NAGA DURGA SAI BABU
S.NAGA DURGA SAI BABU - avatar
5 odpowiedzi
+ 5
@Aswini wrote: << simply we can use 'bgcolor' >> Simply we must not ^^ Because 'bgcolor' attribute is deprecated in Html5, as almost of styling attributes which are intended to be replaced by Css styling... However, Html is permissive and browsers are expected to correct bad syntax as well as they can (so implicitly, html 'bgcolor' attribute is corrected by being auto replaced by 'background-color' Css property ;) ). But it's strongly recommended to no more use html attributes for styling elements ^^ Anyway, 'background-color' can be shortened by 'background', since you define other background family Css properties wich will be overwrite by 'background' shorthand since they are declared before or with css selector with mor priority weight :P https://developer.mozilla.org/en-US/docs/Web/CSS/background?v=example
5th Jun 2017, 2:09 PM
visph
visph - avatar
+ 4
With CSS. It can be applied to an element inline using the style attribute, but a seperate CSS file is much preferred. Here is it inline:i99 <html> <head> </head> <body style="background-color:#FFFFFF"> <div>Content</div> </body> </hyml> And this is a stylesheet: body { background-color: #FFFFFF; } I recommend learning the basics of CSS so you do not need to ask a quetion about every attribute.
5th Jun 2017, 10:56 AM
Taija
Taija - avatar
+ 2
In CSS: body{ background-color: white; } Can change white to any other color or color code
5th Jun 2017, 10:56 AM
Maart
Maart - avatar
+ 2
simply we can use 'bgcolor'
5th Jun 2017, 11:03 AM
Aswini
Aswini - avatar
+ 1
background-color as you requested..... p { background-color: red; }
5th Jun 2017, 10:59 AM
Lawal Olanrewaju Emmanuel
Lawal Olanrewaju Emmanuel - avatar