Design a Webpage Like Technical Documentation Using HTML and CSS



Learn how to design a technical documentation website using HTML and CSS. Website's layout is focused on optimized content organization in the field of programming documentation to provide user friendly navigation.

To achieve a non-technical look and feel, HTML is used for content layout and CSS for structuring and presentation this documentation user friendly.

Documentation

Key Steps to Design Responsive Technical Documentation Website

The implementation approach consists of several key points that contribute to the overall design and functionality of the webpage ?

  • HTML Structure ? The structure of the HTML document and its division into sections use semantic HTML elements; such as <header>, <nav>, <main>, <section>, etc.
  • Navigation Bar ? On the left side there is constantly present vertical navigation bar that has to be labeled as #navbar which is useful for moving through the documentation allowing for better experience. Learn: How to create a responsive Navigation Bar.
  • Responsive Design ? To make webpage accessible across different devices, the responsive design will be used in the source code.
  • Styling with CSS ? Body background, the font type, colours, and spaces used in the document are some of the aspects that the CSS file form part and parcel of the beautiful looks.
  • Code Highlighting ? Code fragments are inserted into a styled <code> tag, enhancing content comprehension and giving special styling to examples in the documentation.
  • List Organization ? New concepts are also written using bullet points <ul> and <li> to allow users easily identify key points.
  • Color Scheme ? Colour schemes are used to achieve a good contrast between the text and its background so as to be easily readable and pleasing to the eyes.
  • Hover Effects ? The effects are applied on links contained in the navigation bar to make the menu interactive and display effects whenever users move through the menu.
  • Accessibility Considerations ? Correct tag and structure are used in the HTML to make it as easy as possible for a screen reader to get round the content.
  • Commenting Code ? There are comments in the code to enable the later developers to understand the concepts used when building the different components of the program.

HTML and CSS Code to Design Technical Documentation Website

Here is the complete code, you can copy and use it in your design to create a beautiful and attractive technical documentation webpage ?

HTML File

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>C++ Documentation</title>
</head>

<body>
<div class="main-body">
   <nav id="navbar">
      <header>Documentation Menu</header>
      <a href="#Intro" class="nav-link">What is C++</a>
      <a href="#Object" class="nav-link">Objects and Classes</a>
      <a href="#Inheritance" class="nav-link">Inheritance</a>
      <a href="#Polymorphism" class="nav-link">Polymorphism</a>
      <a href="#Abstraction" class="nav-link">Abstraction</a>
      <a href="#Encapsulation" class="nav-link">Encapsulation</a>
   </nav>

   <main id="main-doc">
      <section class="main-section" id="Intro">
         <header>What is C++?</header>
         <p>C++ is a general purpose programming
            language and widely used now a days '
            for competitive programming. It has
            imperative, object-oriented and generic
            programming features. C++ runs on lots of
            platform like Windows, Linux, Unix, Mac etc.
            C++ is an efficient and powerful language and finds wide use
            in various GUI platforms, 3D graphics and
            real-time simulations. Because of the
            inclusion of rich function libraries,
            working in C++ becomes simpler and
            convenient than C. Being object-oriented
            programming like Java, C++ provides
            the support of inheritance, polymorphism,
            encapsulation, etc. Unlike C, C++ allows
            exception handling and function overloading..</p>
         <p>The "Hello World" program is the first step towards learning any programming language...</p>
         <code>
            #include<iostream> <br>
            using namespace std; <br>
            int main() <br>
            { <br>
               cout << "Hello World"; <br>
               return 0; <br>
            }
         </code>
         <p>C++ is an Object-Oriented Programming Language. The main pillars of Object-Oriented Programming are:</p>
         <ul>
            <li>Objects and Classes</li>
            <li>Inheritance</li>
            <li>Polymorphism</li>
            <li>Abstraction</li>
            <li>Encapsulation</li>
         </ul>
      </section>

      <section class="main-section" id="Object">
         <header>Objects and Classes</header>
         <p> Object-oriented programming - As the name
            suggests uses objects in programming.
            Object-oriented programming aims to
            implement real-world entities like
            inheritance, hiding, polymorphism,
            etc in programming. The main
            aim of OOP is to bind together the data
            and the functions that operate on them
            so that no other part of the code can
            access this data except that function.</p>
         <p><b>Object : </b>An Object is an identifiable
            entity with some characteristics and behavior.
            An Object is an instance of a Class. When a
            class is defined, no memory is allocated but
            when it is instantiated (i.e. an
            object is created) memory is allocated.
            <br>
            <b>Class : </b>The building block of C++ that
            leads to Object-Oriented programming is a Class.
            It is a user-defined data type, which holds its
            own data members and member functions, which can
            be accessed & used by creating an instance
            of that class. A class is like a blueprint for
            an object. For Example: Consider the Class
            of Cars. There may be many cars with different
            names and brand but all of them will share
            some common properties like all of them will
            have 4 wheels, Speed Limit, Mileage range etc.
            So here, Car is the class and wheels,
            speed limits, mileage are their properties.</p>
      </section>

      <section class="main-section" id="Inheritance">
         <header>Inheritance</header>
         <p>The capability of a class to derive
            properties and characteristics from
            another class is called Inheritance.
            Inheritance is one of the most important
            feature of Object Oriented Programming.
            Sub Class: The class that inherits
            properties from another class
            is called Sub class or Derived Class.
            Super Class: The class whose properties
            are inherited by sub class is called Base
            Class or Super class. Using inheritance, we
            have to write the functions only one time
            instead of three times as we
            have inherited rest of the three classes
            from base class(Vehicle).</p>
         <p><b>Mode of Inheritance : </b><br><br>
            <b>Public Mode : </b>If we derive a sub
            class from a public base class. Then the
            public member of the base class will
            become public in the derived class and
            protected members of the base class
            will become protected in derived class.
            <br><br>
            <b>Protected Mode : </b>If we derive a
            sub class from a Protected base class.
            Then both public member and protected
            members of the base class will become
            protected in derived class.
            <br><br>
            <b>Private Mode : </b>If we derive a
            sub class from a Private base class.
            Then both public member and protected
            members of the base class will become
            Private in derived class.
            <br><br>
            <b>Types of Inheritance in C++ : </b>
            <br><br><br>
            <b>Single Inheritance :</b> In single
            inheritance, a class is allowed to inherit
            from only one class. i.e. one sub class
            is inherited by one base class only.
            <br><br>
            <b>Multiple Inheritance :</b> Multiple
            Inheritance is a feature of C++ where a
            class can inherit from more than one
            classes. i.e one sub class is inherited
            from more than one base classes.
            <br><br>
            <b>Multilevel Inheritance :</b> In this
            type of inheritance, a derived class is
            created from another derived class.
            <br><br>
            <b>Hieratical Inheritance :</b> In this
            type of inheritance, more than one sub
            class is inherited from a single base
            class i.e. more than one derived class
            is created from a single base class.
            <br><br>
            <b>Hybrid (Virtual) Inheritance :</b>
            Hybrid Inheritance is implemented by
            combining more than one type of
            inheritance.
            For example: Combining Hierarchical
            inheritance and Multiple Inheritance.</p>
      </section>

      <section class="main-section" id="Polymorphism">
         <header>Polymorphism</header>
         <p>The word polymorphism means having many
            forms. In simple words, we can define
            polymorphism as the ability of a message
            to be displayed in more than one form.
            A real-life example of polymorphism, a
            person at the same time can have
            different characteristics.
            Like a man at the same time is a father,
            a husband, an employee. So the same
            person posses different behavior in
            different situations. This is called
            polymorphism. Polymorphism is considered
            as one of the important features of Object
            Oriented Programming.
            <br>
            <b>In C++ polymorphism is mainly
            divided into two types:</b>
            <br> 1. Compile time Polymorphism<br>
            2. Runtime Polymorphism</p>
  
         <p>Compile time polymorphism: This type of
            polymorphism is achieved by function
            overloading or operator overloading.
            <br> Runtime polymorphism: This type
            of polymorphism is achieved by
            Function Overriding.</p>
      </section>

      <section class="main-section" id="Abstraction">
         <header>Abstraction</header>
         <p>Data abstraction is one of the most
            essential and important feature of object
            oriented programming in C++. Abstraction
            means displaying only essential information
            and hiding the details. Data abstraction
            refers to providing only essential information
            about the data to the outside world,
            hiding the background details or implementation.
            <br> Consider a real life example of a man driving
            a car. The man only knows that pressing the
            accelerators will increase the speed of car
            or applying brakes will stop the car but he
            does not know about how on pressing accelerator
            the speed is actually increasing, he does
            not know about the inner mechanism of the car
            or the implementation of accelerator, brakes
            etc in the car. This is what abstraction is.</p>

         <p><b>Abstraction using Classes:</b> We can
            implement Abstraction in C++ using classes.
            Class helps us to group data members and member
            functions using available access specifiers. A
            Class can decide which data member will be
            visible to outside
            world and which is not.
            <br>
            <b>Abstraction in Header files:</b> One
            more type of abstraction in C++ can be
            header files. For example, consider the
            pow() method present in math.h header file.
            Whenever we need to calculate power of a
            number, we simply call the
            function pow() present in the math.h header
            file and pass the numbers as arguments
            without knowing the underlying algorithm
            according to which the function is actually
            calculating power of numbers.
            <br><br><b>Advantages of Data Abstraction:</b><br>
            1. Helps the user to avoid writing
            the low level code.<br> 2. Avoids code
            duplication and increases reusability.<br>
            3. Can change internal implementation of
            class independently without
            affecting the user.<br> 4. Helps to
            increase security of an application or program
            as only important details are
            provided to the user.</p>
      </section>

      <section class="main-section" id="Encapsulation">
         <header>Encapsulation</header>
         <p>In normal terms Encapsulation is defined
            as wrapping up of data and information
            under a single unit. In Object Oriented
            Programming, Encapsulation is defined as
            binding together the data and the functions
            that manipulates them. Consider
            a real life example
            of encapsulation, in a company there are
            different sections like the accounts section,
            finance section, sales section etc. The finance
            section handles all the financial transactions
            and keep records of all the data related to
            finance.
            Similarly the sales section handles all the
            sales related activities and keep records of
            all the sales. Now there may arise a situation
            when for some reason an official from finance
            section needs all the data about sales in a
            particular
            month. In this case, he is not allowed to
            directly access the data of sales section.
            He will first have to contact some other
            officer in the sales section and then
            request him to
            give the particular data. This is what
            encapsulation is. Here the data of
            sales section and the
            employees that can manipulate them are
            wrapped under a single name "sales section".</p>
         <p>Encapsulation also lead to data abstraction
            or hiding. As using encapsulation also hides
            the data. In the above example the data of
            any of the section like sales, finance or
            accounts is hidden from any other section.<br>
            In C++ encapsulation
            can be implemented using Class
            and access modifiers.</p>
      </section>
   </main>
</div>
</body>
</html>

CSS File (style.css)

/* Background and font styling */
body {
   font-family: 'Arial', sans-serif;
   margin: 0;
   padding: 0;
   background: url('background.jpg') no-repeat center center fixed;
   background-size: cover;

   color: #333;
   line-height: 1.6;
}

/* Main body container */
.main-body {
   display: flex;
   width: 100%;
   min-height: 100vh;
   background-color: rgba(255, 255, 255, 0.9); /* For readability over background */
   box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}

/* Navbar styling */
#navbar {
   width: 250px;
   padding: 20px;
   background-color: #223140;
   color: white;
   display: flex;
   flex-direction: column;
   position: fixed;
   top: 0;
   left: 0;
   height: 100%;
   box-shadow: 3px 0px 5px rgba(0, 0, 0, 0.2);
}

#navbar header {
   font-size: 24px;
   margin-bottom: 20px;
   text-align: center;
}

.nav-link {
   color: #ecf0f1;
   text-decoration: none;
   padding: 10px 0;
   transition: background-color 0.3s ease;
}

.nav-link:hover {
   background-color: #070707;
   padding-left: 10px;
}

/* Main content styling */
#main-doc {
   margin-left: 250px;
   padding: 40px;
   width: calc(100% - 250px);
   background-color: #ecf0f1;
}

.main-section {
   margin-bottom: 40px;
}

.main-section header {
   font-size: 28px;
   margin-bottom: 15px;
   color: #16496a;
}

p {
   font-size: 18px;
   line-height: 1.8;
}

/* Styling for code blocks */
code {
   background-color: #000000;
   color: white;
   display: block;
   padding: 10px;
   margin: 10px 0;
   border-radius: 4px;
   font-size: 16px;
}

/* List Styling */
ul {
   margin-left: 20px;
   font-size: 18px;
}

ul li {
   margin-bottom: 10px;
}

/* Enhancing links within the content */
a {
   color: #036cb2;
   text-decoration: none;
}

a:hover {
   text-decoration: underline;
}

Output

When you run the above given HTML code along with the CSS, you will see the webpage like this ?

Technical Documentation Website Using Html and CSS

Features

The result of this implementation is useful normalized and styled HTML which presents documentation of C++ language properly and in details. Users can expect the following features ?

  • It has a left-side navigation bar that can be used to navigate to the different sections of the site like "What is C+ +", "Objects and Classes", "Inheritance" and others.
  • A main body of the website where all the important explanations of computer notions and C++ are provided with clear and easy-to-read coding.
  • When the layout of the text should be attractive and for that, the proper color combination and proper font style should be chosen.
Updated on: 2024-10-01T17:27:14+05:30

234 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements