CSS inline block is failing to create a new line

Hey there, I'm trying to create this webpage but I'm encountering an issue. I'm using the inline-block property, but it's not creating a new line; instead, everything is just staying in a straight line. I need it to move to a new line once it reaches the padding limit of MainPage. How can I achieve this? I thought that inline automatically made a newline.

Thank you.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <style>

        #MainPage {
            padding-left: 230px;
            padding-right: 230px;
        }

        body > #body-container {
            height: auto;
            min-height: 100%;
        }

        .pageData {
            display: table;
            table-layout: fixed;
            width: 100%;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }

        .PageInner {
            display: table-row;
        }

        .PageCard {
            margin: 0 0 10px;
            border: 0;
            background: #fff;
            box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }

        .gridItem {
            display: inline-block;
            margin-right: 10px;
            vertical-align: top;
            width: 196px;
            word-wrap: break-word;
        }

        #Pagebox {
            border-bottom: 1px solid #e2e2e2;
            padding-left: 18px;
            padding-right: 18px;
        }

        .UL-Slider {
            width: 100%;
            overflow: visible;
            position: relative;
            left: 0;
            white-space: nowrap;
            font-size: 0;
            vertical-align: top;
            -moz-transition: left .3s ease-in-out;
            -webkit-transition: left .3s ease-in-out;
            transition: left .3s ease-in-out;
        }

        .MovieItem {

            display: inline-block;
            margin-right: 10px;
            vertical-align: top;
            width: 196px;
            word-wrap: break-word;
        }

        .Video-CFix {
            font-size: 11px;
            color: #767676;
            position: relative;
        }

        .LockUp-Thumbnail {
            margin-bottom: 4px;
        }

        .VideoThumb {
            font-size: 0;
        }

        .VideoTitle {
            margin-right: 20px;
            font-size: 13px;
            margin-bottom: 1px;
            max-width: 196px;
        }


    </style>

</head>
<body>

<div id="body-container">
    <div id="MainPage">

        <div class="pageData">
            <div class="PageInner">

                <div class="PageCard">
                    <div class="gridItem">

                        <div id="Pagebox">
                            <ul class="UL-Slider">

                                <li class="MovieItem">

                                    <div class="Video-CFix">

                                        <div class="LockUp-Thumbnail">
                                            <div class="VideoThumb">
                                                <img src="http://www.amusingtime.com/images/043/mr-bean-funny-face-expression-image-for-facebook.jpg"
                                                     width="196" alt="" height="110">
                                            </div>
                                        </div>

                                        <div class="lockup-title">
                                            <span class="VideoTitle">
                                                <a href="#">Movie</a>
                                            </span>
                                        </div>

                                    </div>
                                </li>
                                
                                /* Additional li with MovieItem content here */

                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

Answer №1

I have made some adjustments to your CSS code. Please remove the 'whitespace: nowrap' from .UL-Slider, eliminate the width property from .gridItem, and reduce the padding in #MainPage.

#MainPage {
    padding-left: 100px;
    padding-right: 100px;
}

body > #body-container {
    height: auto;
    min-height: 100%;
}

.pageData {
    display: table;
    table-layout: fixed;
    width: 100%;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.PageInner {
    display: table-row;
}

.PageCard {
    margin: 0 0 10px;
    border: 0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.gridItem {
    display: inline-block;
    margin-right: 10px;
    vertical-align: top;
    word-wrap: break-word;
}

#Pagebox {
    border-bottom: 1px solid #e2e2e2;
    padding-left: 18px;
    padding-right: 18px;
}

.UL-Slider {
    width: 100%;
    overflow: visible;
    position: relative;
    left: 0;
    white-space: normal;
    font-size: 0;
    vertical-align: top;
    -moz-transition: left .3s ease-in-out;
    -webkit-transition: left .3s ease-in-out;
    transition: left .3s ease-in-out;
}

.MovieItem {

    display: inline-block;
    margin-right: 10px;
    vertical-align: top;
    width: 196px;
    word-wrap: break-word;
}

.Video-CFix {
    font-size: 11px;
    color: #767676;
    position: relative;
}

.LockUp-Thumbnail {
    margin-bottom: 4px;
}

.VideoThumb {
    font-size: 0;
}

.VideoTitle {
    margin-right: 20px;
    font-size: 13px;
    margin-bottom: 1px;
    max-width: 196px;
}
 

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

Determining the total of input values based on identification number

Can anyone help me figure out how to calculate the total sum of the values entered using IDs? I've been struggling with it and can't seem to get it to work. Your assistance would be greatly appreciated. <input type="number" id=&quo ...

Sending Ajax GET request following the first Ajax POST request

Upon completing the initial ajax post, I am attempting to make a second ajax call. The initial call is a POST and the second call is a GET. Even though I am able to retrieve the values from the url file.php in the second call, I am facing difficulties in u ...

Properly spaced website images

I'm trying to display my images side by side with a slight margin in between them. However, when I apply a `margin-right: 10px;` to each div, the last image doesn't line up properly with my title bar. Is there a way to create spacing between the ...

Adjust the styling of the anchor tag within the selected div by utilizing jQuery

I am struggling with changing the color of a specific anchor tag when clicked inside a div with class .product_wishlist. Currently, all anchor tags within .pw div are changing colors. Is there a way to apply selected css only to the clicked element? Any he ...

Unable to show the company logo in the navigation bar

Working on a pizza site and encountering an issue - trying to add the logo of the place to the navbar (which also links to the main page) but it's not displaying. Using Twitter Bootstrap for this project. Here is the code snippet: /*#557c3e green*/ ...

Strikethrough text with a distinct color similar to that seen in email messages

In my endeavor to customize the line-through text decoration in red and change the text color to black or any other color for an email, I have experimented with various methods. These include wrapping the text in a span and setting its color to red, using ...

Using jQuery to retrieve child elements and assign numerical values to them

Looking for a jQuery function that can apply different CSS attributes to children elements of a div. <div class="container"> <div class="autogenerated-div"></div> <div class="autogenerated-div"></div> <div class="aut ...

PHP mail function malfunctioning when trying to send images

When using the PHP mail function to send email attachments, I'm encountering an issue where only the file name is displayed in the email instead of the actual image. <?php //if "email" variable is filled out, send email if (isset($_REQUEST ...

Limit the maximum column gap on the grid and stop it from expanding further

I'm currently facing an issue with some columns/rows on my website that are keeping content locked in the top left corner, reminiscent of early 00's web design. The site was originally designed for smaller screens like 1024x764, so when viewed on ...

Unable to successfully implement the Bootstrap dropdown feature in my header upon switching pages

Utilizing Ruby on Rails and Bootstrap 5.3 to develop a website for showcasing my projects and information. I have a header file that contains all of the navbar code. Once I visit any link from one of the dropdown options, the dropdown button stops function ...

The act of linking an SVG image from the same SVG file can result in the disappearance

Can anyone help me figure this out? I'm facing a strange issue: <svg aria-hidden="true"> <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#down"></use> </svg> <table> <tr> <td> ...

PHP does not seem to be compatible with Ajax

I attempted to utilize ajax for inserting data into my database, but it was unsuccessful. To troubleshoot, I created a basic call to a PHP file which also failed: Below is the HTML code snippet: <form> <h4 class="header-title m-t-0 m-b-30"& ...

How can I attach :after and :before pseudo-elements to a submit button?

I'm attempting to enhance my submit button with :after/:before elements, but I'm having trouble getting it to work properly. Specifically, I want to add a swipe (Sweep To Right) transition effect on the button from left to right. Similar to - th ...

How can I use jQuery to reload the page only at certain intervals?

I'm currently using jQuery to reload a page with the code provided below: <script type="text/javascript"> $(document).ready(function(){ setInterval(function() { window.location.reload(); }, 10000); }) & ...

Exploring the implementation of Javascript, HTML, PHP, and Ajax in programming

<div class="navigation"> <a class="prev" href="index.php?month=__prev_month__" onclick="$('#calendar').load('index.php?month=__prev_month__&_r=' + Math.random()); return false;"></a> <!-- <div class="title" & ...

CSS refusing to recognize the display initializr

I am facing a challenge in making the second paragraph visible in this sample code. So far, my attempts have been on Firefox. <!DOCTYPE html> <html> <head> <style> body { display: none; } .show { display: initial; } </ ...

"Implementing a real-time countdown using jQuery on a dynamically generated

I require some assistance in implementing the jquery countdown plugin by Keith Wood. My task involves creating multiple countdowns by fetching data from a MySQL database using a PHP AJAX call, and then inserting it into a div: In my PHP file (getdetails. ...

Is it possible to change %20 in a URL to a hyphen?

Is there a way for my search form to display %20 in the URL when I fill the input field with spaces? For example: Basketball coach Current output: basketball%20coach Desired output: basketball-coach <form action="/tag/" id="form-hockey_v1" name=" ...

The issue in AngularJS 1.4 where the select element value is not binding due to a type mismatch

My ng-model has a value assigned to it, but it is not binding with the selected element. <select data-ng-model="myval"> <option value="? number:2 ?"></option> <option value="2" class="ng-binding">Value 1</option> <op ...

Ruby on Rails slider bar functionality

Currently, I am developing a video-focused application using Ruby 1.9.2 and Rails 3.1. One of the key features I need to implement is a slider bar that allows users to adjust the total duration of a video in real-time. Despite my attempts to use HTML5 fo ...