When resizing, the image and text exceed the limits of the div - Bootstrap 4

After diving into learning bootstrap, I decided to create a basic webpage summarizing F1 races. But alas, my layout got awfully mixed up! The image of the race driver and the text with the fastest lap driver's name are spilling out of their respective divs upon browser resize. If someone could help me pinpoint where I slipped up, I'd greatly appreciate it because my attempts at fixing it have been futile so far. Take a peek at these screenshots:

normal browser size

resized_1

resized_2

Here's a snippet of the HTML:

<head>
    <title>Critical F1 Events</title>
    <meta charset="utf-8"/>
    
    <!-- More meta tags here -->
    
    <script src="../../raphael-2.1.4.min.js"></script>
    <script src="../../justgage.js"></script>
    
    <!-- JavaScript code snippets -->

    <link rel="stylesheet" href="../../css/bootstrap.min.css" type="text/css"/>

    <!-- Additional stylesheet links -->

    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="../../js/bootstrap.min.js"></script>

Some CSS styling bits:

@font-face{ 
      font-family: Formula1; 
      src: url('Formula1-Regular.ttf'); 
  }
      
  /* Other font styles */

body{
    font-family: Formula1, sans-serif;
    color: black;
}

/* Header styles */
.header h1{
    text-align: center;
    font-weight: bold;
    margin-top: 25px;
    font-size: 50px;
}

/* Specific classes styling like .next_prev, .footer, .banner_sub */
.gauge{
    width: 100%;
    height: 100%;
    margin-top: -70px;
}

#fastest_lap{
    color: purple;
    font-size: 40px;
    margin-bottom: 0;
    font-weight: bold;
}
      

Answer №1

@font-face{ 
font-family: Formula1; 
src: url('Formula1-Regular.ttf'); 
}


@font-face{ 
font-family: Formula1;
font-weight: bold;
src: url('Formula1-Bold.ttf');
}

body{
font-family: Formula1, sans-serif;
color: black;
}

.header h1{
text-align: center;
font-weight: bold;
margin-top: 25px;
font-size: 50px;
}

.header p{
text-align: center;
margin-top: 20px;
margin-bottom: 25px;
}

#navi{
font-size: 60px;
}

.next_prev{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}

.icon-left-open:hover, .icon-right-open:hover{
color: #f3f3f3;
transition: all 0.2s ease-in-out;
}

.footer{
text-align: center;
}
...
... (Remaining content of the code has not been modified)</answer1>
<exanswer1><div class="answer" i="63314767" l="4.0" c="1596874691" a="UmF5ZWVzIEFD" ai="13368658">
<p><div>
<div>
<pre class="snippet-code-css lang-css"><code>@font-face{ 
font-family: Formula1; 
src: url('Formula1-Regular.ttf'); 
}


@font-face{ 
font-family: Formula1;
font-weight: bold;
src: url('Formula1-Bold.ttf');
}

body{
font-family: Formula1, sans-serif;
color: black;
}

.header h1{
text-align: center;
font-weight: bold;
margin-top: 25px;
font-size: 50px;
}

.header p{
text-align: center;
margin-top: 20px;
margin-bottom: 25px;
}

#navi{
font-size: 60px;
}

.next_prev{
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}

.icon-left-open:hover, .icon-right-open:hover{
color: #f3f3f3;
transition: all 0.2s ease-in-out;
}

.footer{
text-align: center;
}

.banner_sub{
text-align: center;
height: 380px;
padding: 10px;
border-bottom-right-radius: 25px;
border-right: solid 2px #d0d0d2;
border-bottom: solid 2px #d0d0d2;
margin-top: 10px;
}

.banner_sub:hover{
border-right: solid 2px #e10600;
border-bottom: solid 2px #e10600;
}

.gauge{
width: 100%;
height: 100%;
margin-top: -70px;
}


#fastest_lap{
color: purple;
font-size: 40px;
margin-bottom: 0;
font-weight: bold;
}

.dotd{
border-radius: 20px;
margin-top: 35px;
width: 60%;
}
<head>
    <title>Najważniejsze wydarzenia F1</title>
    <meta charset="utf-8"/>
    ... (Remaining content has not been altered) ...       
</body>

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

Troubleshooting the Angular 7 mat-select issue caused by the "ellipsis" CSS property with three dots

I am facing an issue with a mat-select property called "ellipsis". The three points appear in a different color than the text itself. I attempted to change it to white using the following code, but the dots still remain black. ::ngdeep .example{ ...

Working with Ext JS: Dynamically adjusting panel size when the browser window is resized

I am facing an issue with a side panel in Ext.js. Everything is working fine until I resize the browser, at which point some components of the panel get cut off. https://i.sstatic.net/eaEGI.png Is there a way to make the panel resize automatically when t ...

What steps can I take to address security issues related to iframes?

Are there other security risks to consider when using iframes besides XSS vulnerabilities? How can I ensure that my website is secure when utilizing iframes? I've seen some JavaScript code that uses top.window, but I'm hesitant to rely on client ...

When you click on the input field, a file manager window will open. You can then select a file and the URL of the selected file will be automatically added to the

I need assistance with customizing the code to open the flmngr window and add the URL of the selected file to the input field when onclick. window.onFlmngrAndImgPenLoaded = function() { var elBtn = document.getElementById("btn"); // Style bu ...

How can one extract the text from a title tag nested within a text tag using Selenium WebDriver?

How can I extract the text "Open" from a title tag inside of a text tag using Selenium Webdriver and print it? The HTML code is as follows: enter image description here After trying different xpaths, I get 2 results: //div[@class='visual visual-card ...

What is the procedure for launching an HTML file from a command line interface?

I've got an html file named test.html. Here's a snippet of the file: <!DOCTYPE html> <html> <body onload="document.getElementById('saveForm').click();"> <form method="post" enctype="multipart-form-data" name="my_fo ...

Error in JQuery Document Ready AJAX function causing image to not load initially without a page refresh

Currently, I have a piece of customized code that extracts data from an XML file and uses this data to populate specific content on my webpage: $(document).ready(function() { $.ajax({ type: 'GET', url: 'config.xml?date=& ...

Playing around with adjusting the size of a div that is positioned absolutely on the right side

Snippet: http://jsfiddle.net/scottbeeson/TU6Zw/ HTML Code: <div id="itemMap" class="shadow"> <div class="mapHeader">List of Items</div> <div class="mapItem">Item 1</div> <div class="mapItem">Item 2</div& ...

Jquery attribute not functioning correctly when setting the 'required' property for checkboxes

One of the challenges I am facing is trying to toggle a text box on a checkbox's click event. While I have achieved success in this aspect, my issue lies in changing the checkbox's required attribute as well. Below is the code that successfully ...

Controlling HTML components without using the runat="server" attribute

It's just a dream for now; it's not reality. Homepage.aspx <ul id="menumenu" runat="server"> <li><a href="www.google.com">google</a></li> <li><a href="www.yahooo.com">yahooo</a></li> ...

A horizontal navigation bar featuring a centrally aligned vertical layout and full-height display

I want to align everything on my menu bar vertically in the center, with the a elements taking up 100% of the available height of the menubar (text would be vertically-centered). However, I do not want to fix the height of my menu bar. (If I were to fix th ...

Resetting several sticky titles after displaying and hiding elements

Inspired by a popular codepen example, I have successfully implemented sticky titles in my sidebar. However, when integrating these sticky titles with the functionality to show/hide related items on click, I encountered some unexpected issues. The code sni ...

Achieving a 100% height sidebar that remains visible on the screen at all times in Bootstrap

Looking to achieve this specific layout: I want the left col-md-3 to maintain a consistent 100% height and always be visible on the screen - it's going to be a menu. The right side should function normally with scrolling capabilities. Appreciate any ...

Attempting to secure a successful arrangement using a quiz system

My goal is to create a quiz system, but the output currently looks like this: Question1 Answer1 Question1 Answer2 It should actually look like this: Question1 Answer1 Answer2 ... and so on Any suggestions on how I can correct this issue? Here's t ...

Sleek dialog sliding animation with Svelte

I'm struggling with a svelte component that I have and I'm trying to implement a slide down animation when it closes. The slide up animation is functioning correctly, but for some reason the slide down animation is not working. Does anyone have a ...

Access the HTML file from a different directory

I have a directory called "myWebsite". Within this directory, there is a file named "index.html" and another subdirectory named "other". Inside the "other" directory, there are CSS files, JS files, and "page2.ht ...

I'm encountering an issue in Atom where it says "Module 'editorconfig' cannot be found."

I keep encountering an issue in the Atom text editor where it says "Cannot find module 'editorconfig'" every time I try to save a .html file. Even though I had previously installed the EditorConfig package without any problems. How can I resolve ...

What is the best method to implement ajax for showcasing a Bootstrap 4 modal within a Rails 6 application?

Currently, I am facing an issue with modal rendering on my page. Even though it works fine, I do not want to render a modal for each piece every time the page loads. This is the code where the modal is currently being rendered: site/gallery.html.erb < ...

Concealing information beneath a veil of darkness

I'm looking to implement a solution using JS/CSS/HTML5 to hide content within a div container with a shadow effect. The end result should resemble the example image I've provided. Additionally, I'd like the ability to customize the color of ...

Tips on positioning two images in separate locations within a table cell?

I have a cell containing two images. I want one to be centered in the middle of the cell and the other in the top right corner, overlaying the centered image. My goal is to achieve this layout https://jsfiddle.net/5bL56a34/ without specifying the left m ...