Tips for positioning a DIV element in the middle of the available empty space using Bootstrap version 5.1

As a beginner in front-end development, I'm currently working on my website to showcase my Blockchain projects. Right now, my goal is to align the text "Technology is my Passion" in the center of the remaining free space.

How can I achieve this with bootstrap v5.1?

Is there a way to achieve a similar layout to the image below?

https://i.sstatic.net/zrB7S.png


CODE SNIPPET

/*--- basic styling ---*/
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: Hack, monospace !important;
    background-color: #0f0f0f !important;
}

.owner {
        color: #F4364C;
        font-size: 1.2vw;
}

/*--- glitch effect ---*/
.glitch {
      color: #F4364C;
      position: relative;
      font-size: 4vw !important;
}

.glitch::before {
      color: #F4364C;
      position: absolute;
      content: attr(data-text);
      top: 0vh;
      left: 0.3vw;
      width: 100%;
      height: 100%;
      text-shadow: -1px 0 #FFD700;
      background: #0f0f0f;
      overflow: hidden;
      animation: glitch-anim-1 2s infinite linear alternate-reverse;
}
    
.glitch::after {
      color: #F4364C;
      position: absolute;
      content: attr(data-text);
      top: 0vh;
      right: 0.3vw;
      width: 100%;
      height: 100%;
      text-shadow: -1px 0 #C0C0C0;
      background: #0f0f0f;
      overflow: hidden;
      animation: glitch-anim-2 2s infinite linear alternate-reverse;
}
    
@-webkit-keyframes glitch-anim-1 {
      0% {
            -webkit-clip-path: inset(37% 0 1% 0);
            clip-path: inset(37% 0 1% 0);
      }
      // Remaining keyframes omitted for brevity...
}
    
@-webkit-keyframes glitch-anim-2 {
      0% {
            -webkit-clip-path: inset(35% 0 4% 0);
            clip-path: inset(35% 0 4% 0);
      }
      // Remaining keyframes omitted for brevity...
}
<!DOCTYPE html>
<html lang="en">
<head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <meta name="author" content="Joshua">
      
      <title>XXX's Website | XXX</title>
      
      <!-- stylesheet -->
      <link rel="stylesheet" href="style.css">
      
      <!-- bootstrap cdns -->
      <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9efcf1f1eaedeaecffeedeabb0afb0ac">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" 
      integrity="sha384-uWxY/CJNBR+1zjPWmfnSnVxwRheevXITnMqoEIeG1LJrdI0GlVs/9cVSyPYXdcSF" crossorigin="anonymous">
      
      <!-- hack fonts -->
      <link href='//cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e08881838bcd868f8e94a0d3ced3ced0">[email protected]</a>/build/web/hack.css' rel='stylesheet'>
</head>
<body>
      <div class="d-flex flex-column min-vh-100 min-vw-100">
            <div class="container-fluid owner">
                  <p class="text-left">I'm XXX XXX</p>
            </div>

            <div class="container-fluid">
                  <p class="text-center h1 glitch" data-text="Technology is my Passion">Technology is my Passion</p>
            </div>
      </div>
</body>
</html>

Answer №1

A simple solution is to add the class my-auto which will adjust the vertical margins, effectively centering the content vertically within the given space.

/*--- basic styling ---*/
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: Hack, monospace !important;
    background-color: #0f0f0f !important;
}

.owner {
        color: #F4364C;
        font-size: 1.2vw;
}

/*--- glitch effect ---*/
.glitch {
      color: #F4364C;
      position: relative;
      font-size: 4vw !important;
}

.glitch::before {
      color: #F4364C;
      position: absolute;
      content: attr(data-text);
      top: 0vh;
      left: 0.3vw;
      width: 100%;
      height: 100%;
      text-shadow: -1px 0 #FFD700;
      background: #0f0f0f;
      overflow: hidden;
      animation: glitch-anim-1 2s infinite linear alternate-reverse;
}
    
.glitch::after {
      color: #F4364C;
      position: absolute;
      content: attr(data-text);
      top: 0vh;
      right: 0.3vw;
      width: 100%;
      height: 100%;
      text-shadow: -1px 0 #C0C0C0;
      background: #0f0f0f;
      overflow: hidden;
      animation: glitch-anim-2 2s infinite linear alternate-reverse;
}
   ... (The rest of the code remains the same) ...

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Switch out a static image for a dynamic YouTube video using CSS styling

I've been working on customizing a template website, and I want to switch out the current image for a YouTube video. I have the code from YouTube ready to go, but I'm not sure what changes need to be made in the template. Take a look at the CSS ...

Searching for a div table using XPATH in Python

Struggling to extract data from a table using Selenium in Python. Any suggestions on how to achieve this? https://i.stack.imgur.com/rPlKR.png <div class="js--property-table-body project-property-table__body"> <span aria-hidden=&quo ...

Ways to display jQuery values as HTML text

Trying to concatenate the HTML text with the values of item.certificate_name has been a challenge for me. I've experimented with various methods, but none of them seem to work. The specific line I'm referring to is where I wrote . I have alread ...

How can I show the remaining paragraph text upon clicking a button in a responsive manner using CSS and JavaScript?

I want to add a nice animation effect to the height of my text when a button is clicked. I've managed to achieve this by setting a height: 30px with overflow: hidden initially, and then toggling a class with height: 300px. However, I'm facing an ...

Filtering arrays using Vue.js

I have developed a sample e-commerce website to showcase various products to potential customers. The website boasts features like filters, search functionality, and sorting options to enhance the user experience. However, I've encountered an issue sp ...

Which JQuery plugins can transform regular <select> dropdowns into more stylish options?

After an extensive search, I was only able to locate one solution at this link. I scoured the entire internet for alternatives. ...

The accordion feature in Vue.js ensures that click events are not triggered by accident

Recently, I started delving into Vue2. Utilizing the Bootstrap accordion component has been quite handy. However, I am facing an issue where I want to click the 'hello button' without triggering the 'collapse' event. Any suggestions ...

Adsense displays empty ad banners regardless of their predetermined size

Having trouble with Adsense banners? I have a page with three fixed-size banners (336 x 280) and sometimes they appear blank. It's random - one might work while the others don't, or none may work at all. The code is the same for each banner: < ...

Avoid making GET requests when clicking on a link

[UPDATE] I need help troubleshooting an issue with my ajax request. Here is the code snippet that I am working on: <a href="" class="undo_feedback">Undo</a> When I click on the link, it triggers an ajax POST request, but I encounter an error ...

ASP.NET Core MVC: Issue with Passing C# Razor Variable to HTML Tag

GitHub Repo: https://github.com/shadowwolf123987/Gun-Identification-App I'm currently facing an issue in passing the values of two C# variables from the code block defined in my view to the corresponding html tags within the same view. Unfortunately, ...

Finding text outside of a HTML tag with jsoup

I am working with the following HTML code: Data <div class="alg"></div> <div class="alg"></div> Pepsi 791 <div class="alg"></div> <div class="alg"></ ...

Dynamic card resizing to fit changes in window size

Hey, I'm currently working on a card layout and have hit a roadblock. I'd like the images to shrink as the window size decreases proportionally. Goal: Images should decrease in size until 600px width while staying centered up to that point. I& ...

Notification (jQuery) failing to display user messages

Is there a way to retrieve the post title and display it in a notification? The notification's title is extracted from a form and shown in the notification. When the user clicks the submit button, the system captures the duration and title, displaying ...

What could be causing the issue of my navbar text not changing color using CSS?

Despite several attempts, I am unable to change the color of the hyperlinks in blue or purple using the HTML and CSS below. Can anyone point out what I might be missing? nav ul { /* Navbar unordered */ list-style: none; text-align: center; backgr ...

Model binding lacks an input validation method

I am working on a basic Razor page view that contains the following form fields: <div class="col-sm-6"> <label asp-for="Input.FirstName" class="form-label"&g ...

clicking on internal links in the bootstrap side menu causes it to jump

Im trying to add a side menu to a help page. The menu and internal links are functioning properly, but when clicked, the side menu partially goes behind the navbar. As a beginner, I'm not sure how to resolve this issue. Can someone offer some guidan ...

The Django framework does not apply color to the Bootstrap Navbar as expected

I'm currently working on building an E-Commerce Website using Django. I have implemented a Bootstrap navbar, but the CSS styles that I obtained from this source are not functioning properly when placed within the {%block css %} tag. I have attached t ...

Automatic panning of JavaScript on a map

Having some issues with the functionality of the pan function. It's working, but not quite how I need it to. Currently, I have a logo overlaying a map and I want to pan away from the logo automatically to show an infowindow (panning left or right). H ...

Picture in a clear background without any alteration

Is there a way to create a background-color with opacity inside an image without affecting the image itself? The issue lies in the fact that the transparent background-color makes everything underneath it, including text and the image, transparent. Below ...

Tips on revealing concealed information when creating a printable format of an HTML document

I need to find a way to transform an HTML table into a PDF using JavaScript or jQuery. The challenge I'm facing is that the table contains hidden rows in the HTML, and I want these hidden rows to also appear in the generated PDF. Currently, when I co ...