What could be the reason for the text covering the image on the larger breakpoint?

I am having an issue with this code where the Lorem Ipsum text is not staying centered at all times. Instead, it overlaps the image when I reach the large breakpoint. Can you please explain why this is happening and suggest a solution? Here is the current code (please disregard the white background, that was due to Stack Overflow issues):

body {
    background-color: pink;
    font-family: "Nunito", sans-serif;
}

#mainNav {
    font-size: 1.5rem;
    font-weight: 100;
}
#mainNav #navLinks {
    color:white;
}

#mainNav #navLinks:hover {
    color:#EA1C2C;
}

#mainNav .navbar-brand{
    color:#EA1C2C;
}

#MoC span {
    color:#EA1C2C
}

#MoC h1 {
    font-weight: 100;
    font-size: 4rem;
}

@media(max-width: 1200px) {
    #MoC h1{
        font-size: 3rem;
    }
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
    <link rel="stylesheet" href="candy.css">
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,300,400,700&display=swap" rel="stylesheet">
    <title>Museum of Candy</title>
</head>
<body>
    <script src="https://kit.fontawesome.com/8d084e6dec.js" crossorigin="anonymous"></script>
    <nav id="mainNav" class="navbar navbar-dark navbar-expand-md py-0 fixed-top">
        <a href="#" class="navbar-brand">CANDY</a>
        <button class="navbar-toggler" data-toggle="collapse" data-target="#navLinks" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        ...

...

...

...

...

.

</body>
</html>

Answer №1

Your image seems to be having an issue. It is recommended to include the CSS rule max-width: 100%;

CSS

img{
max-width:100%;
height:auto;
}

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

Guide on sending a JavaScript variable as a URL parameter in Django

I need to pass a radio ID to my view, but I'm struggling with how to do it using the GET method in the URL: html: <a href="{% url 'maintenance_issue_fix' %}?radio_id=checked"> <img src="{% static 'images/ma ...

Place the Div directly above a distinct Div

Hey there! I'm currently working on positioning one div on top of another div programmatically (using javascript or css). These divs are completely separate and have the following structure: <div class="bottom"> <img src="image"></i ...

Incorporate a comma after the second or third digit to separate currency values in JavaScript

Is there a way to add commas to currency values at the 3rd or 2nd place depending on the value itself? The desired output format is: 1000 => 1000 10000 => 10,000 210000 => 2,10,000 2010000 => 20,10,000 12010000 => 1,20,10,000 I am currentl ...

"Problem with the Hide/Show Load feature: it's not functioning

After a user submits a form, my script shows 2 divs and hides 1 div. The form's target is an Iframe on the same page. I am looking to delay the Hide/Show events until the Iframe loads. I was successful in accomplishing this with a loading animation, ...

Creating columns with equal heights in Bootstrap 3 without compromising on the column padding

I am using a standard Bootstrap 3 CSS setup and I am trying to give columns inside a row the same height. I have been experimenting with using display: table and display: table-cell, which does work, but it seems to add vertical padding to columns with les ...

Issues with Bootstrap split button display malfunctioning

Experiencing an issue with a Bootstrap split button while working on a test Drupal website. Although it seems to be working fine in Codepen and JSFiddle, on this particular website, the dropdown component appears to be getting pushed under the button. Desp ...

Positioning the Bootstrap4 Modal in React

I have a situation where a component opens a bootstrap modal using react-bootstrap4-modal. The opening and closing mechanism is as follows: {this.state.inEditMode ? <MemberModal /> : null} However, the issue arises because the component is nested ...

When hovering over an image to show a text box using JavaScript, it only works on one image due to the use of getElementById

I have been experimenting with some JavaScript code to create a pop-up box that appears when you hover over images. However, I have encountered an issue where it only works for one image. I suspect this is because I have used IDs instead of classes, but I& ...

What is the reason behind this Uncaught TypeError that is happening?

After converting my questionnaire to a PHP file and adding a validation script, I encountered an error: Uncaught TypeError: Cannot set property 'onClick' of null The error is pointing me to line 163 in my JavaScript file, where the function f ...

How to move a div beneath the JavaScript files in Drupal 7

I am facing a challenge where I need to position a div right above the body tag without interfering with the scripts located above it. Despite my efforts, I have not been successful in achieving this goal. I attempted to use Hook_page_build to position t ...

Issues involving JavaScript and jQuery

As a beginner in the world of JS and jQuery, I have encountered a problem that I am seeking assistance with. I am trying to use a script to insert content into a page, but I am facing a roadblock that I can't seem to overcome. Here's the specific ...

The Order of Transitions Reversed in CSS

I have a unique situation that I'm hoping to get some help with. I've been trying to create an effect where I move text away and lift up a gray box, and then when my mouse moves away from the gray box, the box goes down first before the text move ...

bootstrap radio button that cannot be deselected

I have created a btn-group as shown below: <div class="control-group"> <label class="control-label">Gender</label> <div class="controls"> <input id="filtro_sexo" ty ...

arranging a collection of images based on their values in increasing order

cardShop is a container with various images, each with its own unique ID and value attribute. These values consist of two numbers separated by a comma, such as 2000,500 or 1500,200. My goal is to sort these images in ascending order based on the first numb ...

Inject the HTML code into a bash script and perform operations on it

Could someone help me with a bash scripting question? I'm new to this, so I may have missed it if it's already been answered. I want to pass the html source code of a web page to my script, which will then modify or scrape the web page of its HT ...

Is it permissible to use jQuery within a table tag?

My code structure is a combination of php, jquery, and html as follows: <table> <?php while ($r = mysql_fetch_array($sth)){ ?> <tr> <td> Some HTML tag here </td> </tr> <script ...

Tips for creating a consistently positioned div element, regardless of the screen size

Having trouble positioning two bars with green or blue filling in the bottom right corner? They keep moving around and not staying in place regardless of screen size. Check out how they are off-screen here Below is the CSS-Styling + HTML code: .eleme ...

Tips for managing three select menus in AngularJS

Assistance needed for creating a series of interconnected dropdown menus in AngularJS. The functionality should allow the second dropdown to open upon selecting a value in the first dropdown, and the third dropdown to open upon selecting a value in the sec ...

What is the best way to incorporate a label onto the border of a div while ensuring responsiveness?

I am struggling to design a straightforward appreciation screen with bordered text. The current css I have does not adjust responsively when the screen size changes, causing it to appear misaligned. Below are my CSS and component codes. React JS is being u ...

Centering all td elements except for those with a specific class

Consider the following code snippets: <tr> <td class="foo">chuchu</td> <td>chuchu</td> <td>chuchu</td> <td>chuchu</td> <td>chuchu</td> </tr> Is there a way to center align thes ...