The inline block display is not functioning as anticipated

I am facing an issue with my list elements being displayed as inline-block.

The first child of the ul li element is inlined, but the other li elements are appearing with extra space. This can be seen in the image below:

Here is the CSS for these elements:

<ul class="video-list">

        <li><a href="#">
            <div class="videoimg">

                    <img src="/Images/sample.png" height="150" width="150">

            </div>
        </a>
            <div class="info">

                <a href="javascript:;">name</a>
                <div>
                    Channel: <br>
                    By : 
                    <div>
                        Views : 0
                    </div>
                </div>
            </div>
        </li>
</ul>

li is a repetitive element.

CSS-

.video-list {
    list-style: none;
}

    .video-list li {
        display: inline-block;
        margin: 3px;
        padding: 10px;
        position:relative;
    }
        .video-list li .info {
            bottom:0;
            background:#f5f5f5;
            padding:10px;
            height:120px;
            border:1px solid #e5e5e5;
            border-bottom-left-radius:3px;
            border-bottom-right-radius:3px;
        }

Answer №1

The necessary rule in this case is vertical-align

.list-of-videos li {
        display: inline-block;
        margin: 3px;
        padding: 10px;
        position:relative;
        vertical-align:top; /* Included for alignment*/
    }

Answer №2

To achieve the desired layout, it is important to include vertical alignment

.video-list li {
display: inline-block;
margin: 3px;
padding: 10px;
position:relative;
vertical-align:top; /* specify here */
}

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

Building HTML within an Angular JS Directive

I am in the process of creating a custom directive for a basic modal window, which will be used like this: <modal content="<div class='error-text'>this is the content</div>"></modal> This should result in the following H ...

Transform preexisting Vue UI library measurements into pixels

I was curious about converting all existing units (em / rem) to pixels. How can I easily convert the entire output units to px? Are there any tricks or methods available? Currently, I am utilizing Vuesax UI to create a plugin for various websites and temp ...

How can I use jQuery to dynamically add and remove input values?

I am having trouble with saving and deleting values in a table row. I have an input field and an add button. When I click on the add button, I want the input value to be saved in a table row with a delete button next to it. I need to be able to delete indi ...

Changing the hover color of an Angular Material MD Button

<div class="non-active" layout layout-align='space-around center'> <md-button ng-click="$ctrl.widget.type = 'chart'; $ctrl.validateForm()" layout='column' ng-class="{selIcon : $ctrl.widget.type == ' ...

Replace all occurrences of the forward slash character with the value of DS in the variable $uploadTo

What is the significance of DS? $upload_dir = WWW_ROOT.str_replace("/", DS, $uploadTo); ...

Non-responsive country image in the navigation bar

After successfully implementing a responsive navigation bar using HTML and CSS, I noticed an issue with the flag images within my navigation bar. While the text is responsive, the flag images are not behaving as expected. Can anyone provide assistance with ...

Tips for updating images automatically

I have a HTML file where I display images on a popup window using the code below: <div id="divCheckbox" style="display: none;"> <a class="fancybox" rel="gallery01" title= "BONOS ALQUILER 2/6" href="eventos/Bonos_alquiler.jpg">o ...

The data submitted in the text area does not get saved in the database that was created with PHP and MySQL

Trying to set up a private messaging system where users can communicate with each other and store the messages in a database. Utilizing a random number, known as a hash, to identify conversations between users. Two tables are involved - "message_group" for ...

Using the Match() function with an array of objects

I am working with an object array containing multiple variables. let Novels = []; class Novel { constructor(isbn, title, author, edition, publication, year) { this.isbn = isbn; this.title = title; this.author = author; this.publicat ...

Could the footer formatting problem be due to a CSS issue?

Here is the link: The formatting issue in the footer can be clearly seen. Compare it with other pages on the site to see the correct appearance of the footer. I am unsure if this problem is due to HTML or CSS. Interestingly, when I remove the entire body ...

javascript passing a window object as an argument to a function

In Slider function, I am passing a window object that does not contain the body element. Additionally, my code only functions correctly on mobile screens. While debugging the code below: console.log(windows.document); If (!mySlider) {console.log(windows. ...

Transform a JavaScript variable into a PHP variable

Struggling with converting JS variables to PHP for my project on HTML, CSS, and PHP. The issue lies in passing the user input from a field to a PHP function called getPosForLieferschein(). The goal is to have the table below populate with contract positio ...

Using video instead of static slides in HTML5

I am interested in adding a video background with text overlay on my website, similar to what can be seen here: Although I understand it involves CSS, I am struggling to achieve the desired effect. Here is the code snippet I have been using: video#bgvid ...

Unable to display JSON object in HTML in Angular due to a pipe error

Whenever I include the following code snippet: {{form}} The output is: [object Object] But when I modify it to: {{form | json}} An error occurs: TypeError: Converting circular structure to JSON --> starting at object with constructor 'TView&a ...

Leveraging multiple ">" CSS selectors

Here is the HTML code to style: <table id="my-table"> <tr> <td> I would like to customize this </td> <td> <table> <tr> <td> Not looking to customize t ...

Tips for specifically targeting the accordion panel header when it is clicked

I am currently facing an issue with my accordion that contains lengthy text in the panel body. When I open any accordion, the page scrolls to the top and part of the text gets cut off. Is there a way to fix this problem or do I need to focus on the panel-h ...

Traverse through the subdirectories within a parent directory and retrieve the paths of all files present

Just starting out with PHP and I'm trying to find a script that will loop through all subfolders in a folder and retrieve the file paths within each subfolder. <?php $di = new RecursiveDirectoryIterator('posts'); foreach (new Rec ...

The width of the textarea is too small to accommodate the CodeMirror highlighted JS code text

Today I spent time working with CodeMirror to build a specific environment for editing PHP code stored in a secure database. Everything is functioning properly - the editor, code highlighting, indent tabs - except for one issue that has been bothering me. ...

What is the method for showcasing background images sequentially?

css code #intro { position: relative; background-attachment: fixed; background-repeat: no-repeat; background-position: center top; -webkit-background-size: cover; -moz-background-size: cover; backgr ...

Angular Material Rotate Ink Bar to Vertical Orientation

After wanting to change the orientation of Angular Material's Tab Component to vertical, I visited this page (Tabs) and experimented with the CSS. By making the necessary adjustments, I successfully displayed the tabs vertically using the following CS ...