The Wayback Machine - https://web.archive.org/web/20240703154543/https://www.geeksforgeeks.org/html-course-building-main-content-section-3/
Open In App

HTML course Building Main Content – Section 3

Last Updated : 02 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Course Navigation 

In the previous article, we have seen the 3-Column layout and completed Section 2 of the main content. The main content of the website is now almost complete. We just need to build Section 3 of the main content. Section 3 is shown in the below image: 

If you look at the above image carefully then it can be seen that Section 3 is almost the same as that of Section 2 of the Website. The only difference is that it has 4 columns instead of 3 and every column has an image at the top before the title.
Let’s start writing HTML for Section 3 of our Website, follow the below steps:

  1. Declare a parent div with a class named row.
  2. Declare four div’s inside the parent row div to contain four columns and assign them id’s as column21, column22, column23, and column24 respectively.
  3. Download the images from the given links and save them to your images folder. 
  4. For Each Column: 
    • Use <img> tag to insert image for the respective column.
    • Declare a div with class = “img-title”. For the title of the column.
    • Declare a paragraph p element for the description of the content.
    • Declare an anchor tag <a> to add an external link which will be styled as a button. We will use the same button we created in the last article. So, assign the class “button” to the anchor tag.

Below is the complete HTML code for Section 3 of the Main Content: 

HTML




<!DOCTYPE html>
<html>
 
<body>
    <!-- Section 3 of Main content -->
    <section class="container" id="section-3">
        <div id="row">
            <!-- Column 1 -->
            <div id="column21">
                <img src="images/writer.jpg"
                     class="image image-full">
 
                <div class="img-title">
                    <h3>Technical Content Writer</h3>
                </div>
 
                <p>
                    The work requires understanding of Computer
                    Science concepts. Candidates who are active
                    on Practice Portal will be preferred.
                </p>
 
                <a href="https://www.geeksforgeeks.org/careers/"
                   target="_blank"
                   class="button">
                    Apply Here
                </a>
            </div>
 
            <!-- Column 2 -->
            <div id="column22">
                <img src="images/developer.jpg"
                     class="image image-full">
                <div class="img-title">
                    <h3>Software Developer</h3>
                </div>
               
                <p>
                    Good knowledge of PHP, JavaScript, Amazon AWS
                    and Web Development in general. Candidates who
                    are active on Practice Portal will be
                    preferred.
                </p>
 
                <a href=
                   target="_blank"
                   class="button">
                    Apply Here
                </a>
            </div>
 
            <!-- Column 3 -->
            <div id="column23">
                <img src="images/support.jpg"
                     class="image image-full">
 
                <div class="img-title">
                    <h3>Teaching Assistant</h3>
                </div>
 
                <p>
                    It involves taking the doubt sessions,
                    coordinating with mentors and requires
                    in-depth knowledge of Data Structures
                    and Algorithms.
                </p>
 
                <a href=
                   target="_blank"
                   class="button">
                    Apply Here
                </a>
            </div>
 
            <!-- Column 4 -->
            <div id="column24">
                <img src="images/teacher.jpg"
                     class="image image-full">
 
                <div class="img-title">
                    <h3>Mentor / Tutor</h3>
                </div>
               
                <p>
                    Job involves teaching, problem solving
                    in classes as well as doubt sessions and
                    thus requires in-depth knowledge of Data
                    Structures and Algorithms.
                </p>
 
                <a href="https://www.geeksforgeeks.org/careers/"
                   target="_blank"
                   class="button">
                    Apply Here
                </a>
            </div>
        </div>
    </section>
 
</body>
 
</html>


On running the index.html file in the browser now, you will be able to see the content of Section 3 in a distorted order as that of Section 2 before adding CSS.
Therefore, let’s start adding styles to the classes and complete Section 3 of Main Content: 

  • Adding basic styles for layout: Firstly, set the overflow to hidden and add all the required margins and paddings. Next is to give the thin 1px border at the top of the section to separate it from the previous section and align all the text inside it to the center.
    Add below CSS code to your style.css file: 

CSS




#section-3{
    overflow: hidden;
    padding-top: 5em;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    text-align: center;
}


  • Aligning Columns In-line: The next step is to align all the columns in a single line one after the other. To do this, add the below CSS code to your style.css file:

CSS




/* Add fixed width for each column and
   align text to center */
#column21,
#column22,
#column23,
#column24
{
    width: 282px;
    text-align: center;
}
 
/* Float first 3 columns to left */   
#column21,
#column22,
#column23,
#column24 {
    width: 282px;
    text-align: center;
}
 
#column21,
#column22,
#column23,
#column24 {
    float: left;
    margin: auto 25px;
}


  • Styling the Title of columns: The next good thing to do is to style the title of the columns present just below the images. To give them appropriate font-sizes, padding color etc. apart from the default values. Add the below CSS code to your style.css file: 

CSS




.img-title{
    display: block;
    padding-bottom: 1em;
    font-size: 1em;
    color: rgba(0, 0, 0, 0.6);
}


  • Styling the images: We have added two classes for our images in the column, namely image and image-full.

CSS




.image
{
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, .5);
    border-radius: 5px;
}
     
.image img
{
    display: block;
    width: 100%;
}
     
.image-full
{
    display: block;
    width: 100%;
    margin: 0 0 3em 0;
}
     
.img-title{
    display: block;
    padding-bottom: 1em;
    font-size: 1em;
    color: rgba(0, 0, 0, 0.6);
}


The Complete CSS code for Section 3 of the Main Content of the website is given below: 

CSS




/*****************************************/
/*     Styling Main Content Section 3    */
/*****************************************/
 
#section-3{
    overflow: hidden;
    padding-top: 5em;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    text-align: center;
}
 
.image
{
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, .5);
    border-radius: 5px;
}
     
.image img
{
    display: block;
    width: 100%;
}
     
.image-full
{
    display: block;
    width: 100%;
    margin: 0 0 3em 0;
}
     
.img-title{
    display: block;
    padding-bottom: 1em;
    font-size: 1em;
    color: rgba(0, 0, 0, 0.6);
}
 
/* Add fixed width for each column and
   align text to center */
#column21,
#column22,
#column23,
#column24
{
    width: 282px;
    text-align: center;
}
     
#column21,
#column22,
#column23,
#column24 {
    width: 282px;
    text-align: center;
}
 
#column21,
#column22,
#column23,
#column24 {
    float: left;
    margin: auto 25px;
}


 With this Section 3 of the main content is successfully completed and will now look something as shown in the below image: 

 Supported Browser:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari
     


Previous Article
Next Article

Similar Reads

HTML Course : Building Main Content - Section 1
Course Navigation We just completed building the header for our website. Let's start building the main content for the website. As we described while creating the HTML layout of the website, the main content was divided into three sections as shown below: C/C++ Code &lt;!DOCTYPE html&gt; &lt;!-- Main content between Header and Footer --&gt; &lt;mai
4 min read
HTML Course : Building Main Content - Section 2
Course Navigation In the last article, we began building the main section of the website and have completed the first section. Let us now move to the section 2 of Main Content.You can see the Section 2 of the Main Content in the below image: If you observe carefully, you can say that the section 2 is divided into three columns as shown below: This
4 min read
How to separate the section from another section in HTML ?
HTML Section tag defines the section of documents such as chapters, headers, footers, or any other sections. The section tag divides the content into sections and subsections. The section tag is used when requirements of two headers or footers or any other section of documents are needed. Section tag grouped the generic block of related contents. T
2 min read
HTML Course Understanding and Building Project Structure
Course Navigation We have created all of the directories needed for our project. Let's just start writing our HTML code. Since we are designing a single page website - Website with a single HTML page( No internal links ). So, we will write all of our codes in the file "index.html". We donot need any other HTML to create for this project. Before we
3 min read
HTML Course : Building Header of the Website
Course Navigation So far, we have created the navigation bar for the header of our website. The next thing to complete the header is to include the image and text above the image as shown in below screenshot: Let's again look at the part of the code for the header in our index.html file. The highlighted part of the code shows the image menu of the
4 min read
HTML Course Building Footer
Course Navigation So, we have completed building all parts of our website except the footer. So, let's take a look at what our final footer will look like: Our footer mainly consists of two sections: Company Details: This contains of three columns with address details, phone details and Email details.Copyright Information: This contains information
6 min read
What are the main building blocks of an Angular Application?
Angular is a widely used open-source front-end framework used to build dynamic web applications. It consists of several key building blocks that work together to create scalable, and maintainable applications. In this article, we will explore all the main building blocks of an Angular application and we will explore how they contribute to framework
8 min read
How to Add a "Skip to Main Content" Link in HTML?
Add a 'Skip to Main Content' link in HTML to assist screen reader users by enabling them to quickly access key information, improving website accessibility for all users. This feature allows users to bypass repetitive sections like headers and menus, jumping straight to the main content area. Approach First, Create the basic structure of the web pa
2 min read
How to add content in head section using jQuery/JavaScript?
Any content can be added to the &lt;head&gt; section using the following two approaches: Using the document.head propertySelecting the head element using jQuery Method 1: Using the document.head property. The head property of the document returns the head element of the document. Any new content can be added to this element by using the appendChild
3 min read
Semantic-UI Breadcrumb Section Content
Semantic UI is an open-source development framework that provides pre-defined classes to make our website look beautiful, amazing, and responsive. It is similar to Bootstrap which has predefined classes. It uses jQuery and CSS to create the interfaces. It can also be directly used via CDN like bootstrap. Semantic UI offers a Breadcrumb component fo
2 min read
Article Tags :
three90RightbarBannerImg