The HTML document is experiencing overflow within the body element

I am in the process of designing a website that consists of two main sections. The first section includes a video, a navigation bar, and some introductory text. The second section features an image and a lorem ipsum paragraph. However, these two parts are not displaying correctly together. Do you know what might be causing this issue?

The initial part is contained within the video-container div, which encompasses a video, a navigation bar, and introductory content.

The subsequent section is housed in the intro div, which showcases an image alongside a paragraph.

<style>
        html, 
        body {
            border: 1px solid blue;
            min-height:100%; 
            padding:0; 
            margin:0;}

        * {
            font-family: 'Playfair Display', serif;
            margin: 0;
            padding: 0;
            border: 0;
            outline: 0;
            margin-top: -5px;
        }
        .nav {
            border: 1px solid red;
            margin-right: 30px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .nav li {
            list-style-type: none;
        }
        .nav li a {
            text-decoration: none;
            font-size: 23px;
            font-weight: 600;
            color: #C71585;
            letter-spacing: 0.03em;
        }
        .nav img {
            width: 150px;
        }
        video { 
            width: 100%;
            position: absolute;
            object-fit: cover;
            background-size: cover;
            top: 0px;
            left: 0px;
            min-width: 100%;
            min-height: 100%;
            z-index: -1;
            box-sizing: content-box;
        }
        .video-container {
            position: relative;
            height: 100%;
            border: 1px solid yellow;
        }
        .content {
            border: 1px solid yellow;
            position: absolute;
            left: 50px;
            top: 150px;
            margin: 10px;
            padding: 5px 20px;
            font-size: 20px;
            overflow: none;
        }
        .content h1 {
            font-size: 100px;
            color:  #C71585;
        }
        #myBtn {
            margin-left: 20px;
            margin-top: 40px;
            border: 1px solid #C71585;
            font-size: 26px;
            font-weight: 800;
            color: #e827a0;
            padding: 15px 60px;
            background-color: transparent;
            transition: 0.2s ease-in;
        }
        #myBtn:hover {
            background-color: rgba(199, 21, 133);
            color: white;
        }
        .intro {
            overflow: none;
            margin-top: 30px;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }
        .intro img {
            width: 500px;
        }
        .intro-text {
            width: 30%;
        }

    </style>
</head>
<body>




        <div class="video-container"> 
                <video autoplay muted loop id="video">
                        <source src="video.mp4" type="video/mp4">
                </video>
            <div class="nav">
                <img src="logo.png" alt="logo">
                <li><a href="#">About me</a></li>
                <li><a href="#">My Portfolio</a></li>
                <li><a href="#">My resume</a></li>
                <li><a href="#">Contact me</a></li>
            </div>

            <div class="content">
                <h1>Avid learner and</h1>
                <h1>Constant striver</h1>
                <button id="myBtn">Who am I</button>
            </div>

        </div>

    <div class='intro'>
        <img src="01.jpeg" alt="">
        <div class="intro-text">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pellentesque ex a felis laoreet, ut bibendum sem eleifend. Quisque egestas sem sed velit molestie tincidunt. Phasellus at pellentesque odio. Phasellus sem leo, hendrerit et massa vehicula, iaculis cursus erat. Vestibulum et viverra nisi, sit amet condimentum sem. Duis gravida faucibus nisl nec pharetra. Curabitur convallis risus enim, nec semper lorem cursus varius. Quisque feugiat vitae dui non ultricies. Integer ipsum quam, dictum et quam nec, imperdiet euismod nulla. Nam bibendum sagittis orci, eget tincidunt risus luctus nec. Quisque lacus urna, tincidunt vel lobortis in, suscipit sit amet nunc. Fusce ultrices erat a nunc dignissim hendrerit. Maecenas sed pharetra quam, vitae suscipit nunc. Aenean molestie dui aliquet augue eleifend, quis congue ligula laoreet. Ut quis est pellentesque, fringilla odio ac, tincidunt nibh.
        </div>
    </div>
</body>

Answer №1

If you're looking to implement the css flex property, consider incorporating the following code snippet:

.flex-container {
     display: flex;
     flex-wrap: wrap;
}

Add this code within your style tags and apply the class to a div with the class intro like so:

<div class='intro flex-container'>
. Would this solution meet your needs?

Answer №2

To enhance the layout of your webpage, it's recommended to enclose the .video-container and .intro divs within a wrapping div. Apply the CSS style display: flex to the wrapping div, ensuring to include flex-wrap property as well. Lastly, set the width of both video and intro containers to 100% for a cohesive design.

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

How to properly format an HTML input box for numeric entry and ensure correct formatting of the minus sign

I need assistance with formatting an HTML text input box to only accept numeric values using JavaScript. Specifically, the input should allow digits, a minus sign, or a dot/comma (which will be converted to a dot). However, I want to prevent multiple conse ...

CSS specificity in Angular components utilizing the /deep/ selector to target a class outside of the component's scope

I have developed a button component for an Angular Component Library that I am currently working on. The button functions correctly, and its implementation is as follows: <sio-button [buttonLabel]="'Button Text'" [buttonFormat]="&apos ...

How can I align a single button to the left side while positioning the rest of the elements to the right in Bootstrap 4?

I am attempting to align the B1 button on the left side and have the remaining elements positioned on the right side. Below is my code snippet using Bootstrap 4.1: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/b ...

Customize your Bootstrap design by selecting a background color that doesn't

Why is the dropdown background black when used in a bg-dark navbar but white when used outside of the navbar? I want to use a white dropdown in a dark navbar. Here is my complete code: MyCode Here is my navbar & dropdown: <nav class="na ...

Changing base 64 into Mp3 audio format using PHP

I currently have an "audio" tag with a script (which is essentially a plugin) that receives and saves it as base64. This functionality is working properly. My goal now is to modify the script in order to send the base64 data to the server, convert it to m ...

Having issues with AngularJS where ng-table/ng-repeat rows are failing to load properly

I've been following a tutorial on using ng-Table, which can be found Here. When I download the example from Git, it loads without any issues. However, when I try to replicate even the simplest example myself, the column headers and filters load but th ...

Maintaining text in a straight line

My design includes an image floated to the left with text aligned to the right of the image. Unfortunately, the text is too long, causing a line from a paragraph to drop below the image. How can I ensure that the text stays in line with the paragraph and ...

Difficulty with selecting the nth-child element within an Ember application

In my current project using Ember, I am faced with the challenge of targeting nth-child elements with CSS due to the presence of Ember script tags. Is there a consistent method to achieve this in an Ember application? Instead of the conventional approach: ...

Validating Input in a Textbox Using Jquery When Pasting Data

My HTML textbox is set up to prevent special characters from being entered, but I've noticed that the validation doesn't trigger when I paste text using Ctrl + V. Is there a way to address this issue? ...

The 'order' property in the bootsrap 4 grid is malfunctioning on Safari IOS and not producing the desired outcome

I have encountered an issue where this code performs perfectly on a Windows desktop, but when tested in Safari on iOS, the third column always collapses and jumps to a new line. Here is the code snippet causing the problem: <div class="container"> ...

Give <tbody> the class from the first <tr> using knockout powers

Using the jquery template below results in knockout properly evaluating the databind, but the alert-message block-message class ends up on the <tbody> instead of the targeted <tr>. This issue only occurs when the row with the data-bind is the ...

Text box input that displays the latter portion before the initial part

Looking for assistance with showing the end of the entered text rather than the beginning in an input field. For example, the input could be "Starting portion, Ending Portion". If the input field is limited to 14 characters, instead of displaying the firs ...

Unable to set SimpleLazyObject as the value for the CustomUser model in Django

Hey everyone, I ran into an issue with my blogpost. Every time I try to add a new one, I encounter this error: ValueError at /pages/blog/new/ Cannot assign "<SimpleLazyObject: <CustomUser: <a href="/cdn-cgi/l/email-protection" class="__cf_email__ ...

Is there a way to prevent this picture from shifting?

I am currently revamping the content on my work website using Joomla. I have received the old copy and now I need to enhance it. The website in question is 24x7cloud.co.uk. At the bottom of the page, I aim to include an "Accreditation's" section. Howe ...

What causes the extra gap above an element even when there seems to be no margin or padding applied to it?

I can't seem to figure out why there is extra space above the elements in my nav bar. I've checked the margin and padding, but there is a large gap above my #logo and #searchbox that is causing layout issues. How can I remove the space above thes ...

Display a carousel image in the center with previous and next sliders for easy navigation

Currently, I am referencing this tutorial My goal is to make the image smaller and centered on the page I have made adjustments to the CSS to decrease the size: min-height: 350px; max-width: 900px; However, the image is still aligned to the left and th ...

Conceal a table with jQuery

Is there a way to initially conceal a table on page load only to reveal it with a sliding animation when a specific link is clicked? I have attempted using the following code to hide the table: $('.table_div').hide(); I have enclosed the table ...

Capturing variable data without retaining the information entered

I recently received some code that seems to be malfunctioning, and I'm struggling to pinpoint the issue. The code in question involves a hyperlink (.control_button) that triggers the opening of a form (#convert-form) within a lightbox. Within this for ...

Attempting to iterate over a JSON object and display its contents using HTML

I have been attempting to iterate through this JSON data and display it in an accordion format similar to the one shown here: but unfortunately, my implementation is not functioning correctly. Here is what I currently have: HTML: <div class="a ...

Are your divs getting truncated?

Currently faced with a perplexing issue where inserting elements into a div causes scaling problems, resulting in most of the divs being cut off. This glitch occurs when two new elements are added. Despite changing page sizes and thoroughly debugging by o ...