In: Computer Science
Computer science!:
(Dimension the following html application and describe positioning, dimensions of, and color of all of the section elements. (DESCRIBE ONLY THE SECTION ELEMENTS IN DETAIL)
For A) Everything as given in the HTML and CSS with section height 700 excluded ( commented out as given)
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="square12.css">
<title>Squarespace layout</title>
</head>
<body>
<nav></nav>
<header></header>
<section>
<!-- main paragraph -->
<p></p>
<!-- Two column-type things -->
<div id="flex-container">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
</div>
</section>
<footer></footer>
</body>
</html>
Square12.css
body {
margin: 0;
}
nav {
background-color: royalblue;
height: 75px;
}
header {
background-color: lightskyblue;
height: 400px;
}
section {
background-color: orange;
margin: 75px 100px;
/* height:700px; */
}
footer {
background-color: black;
height: 100px;
}
p {
background-color: khaki;
height: 275px;
margin-bottom: 75px;
}
div.col { background-color: tomato;
border: 2px solid black;
height:50px;}
#flex-container{ height:300px;
background-color:green;}
The section tag will define the group on the webpage if we have topics relating to headings, paragraphs, images, and videos in this case when we put in one place is called a section. In our webpage like this section may occur in different forms like about us page, copyright page, services page, etc, now will get confusion what is difference between section and division, the division is the blank element in which can be possible to put a related group of content together but we should put in the section itself because section will define group all content together, the main difference of section and div that in the google search engine section is very easy to traceable but div is not.
Syntax:
<section> contents with tag elements </section>
Example:
<!DOCTYPE html>
<html>
<head>
<title>Section tag</title>
</head>
<body>
<section>
<h1>Introduction</h1>
<p>Content of Introduction</p>
</section>
</body>
</html>
The section element represents a generic section of a document or application, the basic difference is that the div element should be used for styling or scripting whereas the section element should be used for literal content, when an element is needed only for styling purposes or as a convenience for scripting always have suggestion to make use of section, a general rule is the section element is appropriate only if the element content would be listed explicitly although section is stylable as well it is suggest to use div instead the purpose of section and question for styling or scripting. use section for things like section of chapter or the chapters themselves. the section element represents the generic document section not a wrapper element.
Kindly note that, the div can be used any part of area of the website like inside the section or outside the section.
From the code, the section tag was mention in the html page after header and nav tag so in the webpage will display after nav element, here the reference:
<nav></nav>
<header></header>
<section>
<!-- main paragraph -->
<p></p>
<!-- Two column-type things -->
<div id="flex-container">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
</div>
</section>
<footer></footer>
header, nav, section and footer display on webapge on the basis on the css define for the html tags,
let's discuss about the css section tag,
section {
background-color: orange;
margin: 75px 100px;
/* height:700px; */
}
from css the height is on the comment which means that height alignment will not display according to the webpage. the margin define two values for top and right alignment where is top is 75 px and height 100px; in the webpage it will show like this:
As per margin assign the values it was setup up top and right, now if you remove the comment for the height which is 700px then also there will also not apply on the webpage, which means margin and height can't be work together for this purpose you need to remove margin element from the css,
section {
background-color: orange;
height:700px;
}
Once assign the height, here the output:
I hope you understand how the height work on the webpage, any doubts please let me know.