Latest topics
Most Used Keywords
How to create a box filled with a color with HTML / CSS?
How to create a box filled with a color with HTML / CSS?
How do you create a box filled with a color with HTML / CSS?
Using the CSS3 Box Model, one would fill the Content area as defined in the Style Sheet. The CSS3 Box
Model is essentially a box that wraps around every HTML element. It consists of: margins, borders,
padding, and the actual content.
Explanation of the different parts:
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
So, if we were to define the Content portion to be 200px wide filled with a light blue color, the code would be:
div {
background-color: lightblue;
width: 200px;
}
The whole webpage code (HTML5 & CSS3) would be:
<!DOCTYPE html><html><head><style>div
{ background-color: lightblue; width: 200px; padding:
25px; }</style></head><body><div>Lorem ipsum dolor
sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</
div></body></html>
To learn more, please play with each section:
div {
background-color: lightblue;
width: 200px;
padding: 25px;
border: 25px solid navy;
}
Using the CSS3 Box Model, one would fill the Content area as defined in the Style Sheet. The CSS3 Box
Model is essentially a box that wraps around every HTML element. It consists of: margins, borders,
padding, and the actual content.
Explanation of the different parts:
Content - The content of the box, where text and images appear
Padding - Clears an area around the content. The padding is transparent
Border - A border that goes around the padding and content
Margin - Clears an area outside the border. The margin is transparent
So, if we were to define the Content portion to be 200px wide filled with a light blue color, the code would be:
div {
background-color: lightblue;
width: 200px;
}
The whole webpage code (HTML5 & CSS3) would be:
<!DOCTYPE html><html><head><style>div
{ background-color: lightblue; width: 200px; padding:
25px; }</style></head><body><div>Lorem ipsum dolor
sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</
div></body></html>
To learn more, please play with each section:
div {
background-color: lightblue;
width: 200px;
padding: 25px;
border: 25px solid navy;
}
Similar topics
» Android Game: Pango Paper Color
» What is a div in HTML?
» How to create a box in HTML?
» How to make the input box bigger in HTML?
» What is a div in HTML?
» How to create a box in HTML?
» How to make the input box bigger in HTML?
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Fri Sep 23, 2022 9:26 am by Adminkunlex
» Java app: Oxford English Dictionary 240x320.jar
Fri Sep 23, 2022 9:24 am by Adminkunlex
» Pastor Lines Up Bachelors In Church, Asks Single Ladies To Select For Marriage (Video)
Tue Sep 13, 2022 6:14 am by Adminkunlex
» Watch The Moment Portable Went Crazy At An Event
Mon Sep 12, 2022 9:28 pm by Adminkunlex
» Jimi Odukoya Steals The Show At Woman King's Movie Premiere
Mon Sep 12, 2022 9:21 pm by Adminkunlex
» Jimi Odukoya Steals The Show At Woman King's Movie Premiere
Mon Sep 12, 2022 9:21 pm by Adminkunlex
» Asthmatic Boy Collapses As Police Invade A Church In Delta (Video)
Mon Sep 12, 2022 9:15 pm by Adminkunlex
» Ernest Obi: Any Man Who Doesn’t Sexually Satisfy His Partner Should Be Locked Up
Mon Sep 12, 2022 1:57 pm by Adminkunlex
» Pastor Tobi, Davido, Zlatan Pray And Dine With Eniola Badmus On Her Birthday
Fri Sep 09, 2022 7:07 pm by Adminkunlex
» BBNaija: Eloswag's Mother Begs Nigerians To Vote For Him (Photos, Video)
Thu Sep 08, 2022 6:22 am by Adminkunlex
» Asa Sings 'Fire On The Mountain' In Front Of Buhari At NNPC Relaunch
Tue Jul 19, 2022 10:36 pm by Adminkunlex
» Simi Reacts As Female Fan Rocks Adekunle Gold On Stage In Uganda [Pics]
Tue Jul 19, 2022 10:31 pm by Adminkunlex
» Banky W & Adesua Etomi Attend Mercy Chinwo's Wedding Event (Photos)
Tue Jul 19, 2022 10:28 pm by Adminkunlex
» Burna Boy Meets Mia Mottley, The Prime Minister Of Barbados (Pics)
Tue Jul 19, 2022 10:24 pm by Adminkunlex
» Waje – All Day ft. Tiwa Savage
Tue Jul 19, 2022 6:54 am by Adminkunlex
» [Music] Adekunle Gold – 5 Star Mp3
Tue Jul 19, 2022 6:52 am by Adminkunlex
» [Music] DJ Tunez – Already ft. Amexin
Tue Jul 19, 2022 6:51 am by Adminkunlex
» [Music] Olakira – Polongo Mp3
Tue Jul 19, 2022 6:50 am by Adminkunlex
» [Music] Chike – Hard To Find ft. Flavour Mp3
Tue Jul 19, 2022 6:48 am by Adminkunlex
» [Music] Iyanya – Like ft. Davido & Kizz Daniel
Tue Jul 19, 2022 6:47 am by Adminkunlex
» Java Game: LEGO Batman.jar
Mon Jul 18, 2022 6:10 am by Adminkunlex
» Java Game: Lost Empire.jar
Mon Jul 18, 2022 6:05 am by Adminkunlex
» Actor Uche Odoputa Weds In The UK (Photos)
Sun Jul 17, 2022 12:51 pm by Adminkunlex
» Comedienne Princess Lays Heavy Curses On Yomi Fabiyi And Others
Sun Jul 17, 2022 12:48 pm by Adminkunlex
» Tiwa Savage Bags Honorary Degree From The University Of Kent, UK (photos)
Sun Jul 17, 2022 12:47 pm by Adminkunlex