How To Build a Tiled Layout With CSS (Section 3)

How To Build a Tiled Layout With CSS (Section 3)

In this tutorial, you will recreate the tiled layout of the “Projects” section of the demonstration website by styling eight HTML <div> containers with CSS classes. You will also add the hover pseudo-class to these elements so that they change color when a user hovers over them. Feel free to switch out Sammy’s information with your own if you wish to personalize the size.

Introduction

In this tutorial, you will recreate the tiled layout of the “Projects” section of the demonstration website by styling eight HTML <div> containers with CSS classes. You will also add the hoverpseudo-class to these elements so that they change color when a user hovers over them. Feel free to switch out Sammy’s information with your own if you wish to personalize the size. The methods you use here can be applied to other CSS/HTML website projects.

Gif of “projects" section of the demonstration website

Prerequisites

To follow this tutorial, make sure you have set up the necessary files and folders as instructed in a previous tutorial in this series How To Set Up You CSS and HTML Practice Project.

Adding and Styling a Header Title

To get started, add the heading title “Projects" to a new section on the webpage, making sure not to delete any content you’ve added from the previous tutorials. Add the following code snippet after the last closing </div> tag in the index.html file:

index.html

. . .
<!--Section 3: Projects-->

  <h2 >Projects</h2>
. . .

Copy

The first line of this code snippet is a comment to label the code you will add to create the third section of the website. A comment is used to save explanatory notes on your code for future reference and is not displayed by the browser to site visitors (unless they view the source code of the webpage). The second line adds the title text “Projects” and assigns it the heading element <h2>.

Now let’s style the heading title by creating a section-heading class. Return to the styles.css file and copy and paste the following code snippet at the bottom of the file:

styles.css

. . .

/*  Section 3  */

.section-heading {
  text-align:center;
  color:#102C4E;
  margin-top: 150px;
  margin-bottom:70px;
  font-size: 35px;
}

Copy

This code snippet defines the style for the section-heading class. Please review the previous sections in this tutorial series on setting the sizes of contentpadding, and margins.

css

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire CSS Developer

Want to develop a website or re-design using CSS Development? We build a website and we implemented CSS successfully if you are planning to **[Hire CSS Developer](https://hourlydeveloper.io/hire-dedicated-css-developer/ "Hire CSS Developer")**...

Creating a CSS Visual Cheatsheet

The other day one of our students asked about possibility of having a CSS cheatsheet to help to decide on the best suited approach when doing this or that layout.

7 Best Vue CSS Component for Your App

Vue CSS frameworks are great for many reasons; code is more universally understood, web applications are easier to maintain, and prototyping becomes less of an extra step.

Learn to use variables in CSS (CSS Tricks)

whats the variable in CSS, how to declare use them. Whats the benefit of variables in CSS. Lets learn all this. #Variables #CSS #HTML #CssVariables #ITArticles

CSS Flex Box: A Flexible Way To Layout

Every element of HTML is a rectangular box. Every Box has a defined height and width. This way you can increase or decrease its size.