Styling the Personal Tutor Interface with CSS

Styling the Personal Tutor Interface with CSS

Welcome to the final lesson of our "Developing a Personal Tutor Web Application With Laravel" course! In the previous lesson, you enhanced your personal tutor application by adding query suggestions, making it more user-friendly and efficient for students. Today, we will complete our application by focusing on styling the interface to make it visually appealing and professional. Styling is crucial in educational web applications as it enhances the learning experience by providing a clean and intuitive interface. We will use CSS to achieve this, ensuring that our tutor application not only functions well but also looks great.

Linking the CSS File to Your HTML File

To style your personal tutor interface, we need to create a CSS file and link it to your HTML file.

  1. Create the CSS File: In the public/css directory, create a file named style.css. This file will contain all the styles for your application.

  2. Link the CSS File in HTML: Open your tutor.html file and add a <link> tag within the <head> section to link the CSS file:

<!DOCTYPE html>
<html>
<head>
    <title>Your Personal Tutor</title>
    <link rel="stylesheet" href="/css/style.css">
</head>
<body>
    <!-- Header section... -->
    <!-- Suggestion buttons for common academic queries -->
    <!-- Chat container and input elements... -->
    <!-- Script functions... -->
</body>
</html>

The <link> tag references the CSS file using a path relative to the Laravel public directory (e.g., /css/style.css). In Laravel, all static assets such as CSS files are typically placed in the public directory, so referencing /css/style.css ensures that your styles are correctly loaded and applied to the HTML elements. This setup allows your personal tutor interface to be styled effectively using the CSS rules defined in style.css.

Styling the Basic Structure

Now that we have our CSS file linked, let's start by styling the basic structure of our HTML elements. We'll focus on the html, body, and main container elements to set the foundation for our design.

In your style.css file, add the following styles:

/* Ensure html and body take full height and have no margin or padding */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Set body as a flex container with a column layout and a modern font */
body {
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

These styles ensure that the html and body elements take up the full viewport height, with no margin or padding. The body is set to a flex container, allowing us to easily arrange its child elements in a column. The font-family property sets a clean and modern font for the entire application.

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal