Troubleshooting problem with CSS layout when adjusting the height of a section

I recently delved into creating a simple website using HTML5 and have successfully set up the site structure. Everything has been smooth sailing so far.

However, I've encountered a section of the site that seems to have a mind of its own.

When I assign a height to this particular section, it moves to the top of the article, appearing behind the top two sections while keeping the content within the section in place.

<article><section class="welcome-box">
    <section class="welcome-wrapper">

        <div class="welcome-hello">
            <div class="welcome-hellotext">HELLO, WELCOME TO SAA RECRUITMENT </div>
        </div>

        <div class="welcome-line"></div>

        <div class="welcome-textbox">
            <div class="welcome-textboxtext">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.</div>
        </div>

        <div class="welcome-button">
            <div class="welcome-buttontext">READ MORE</div>
        </div>
    </section>
</section>

<section class="home-slider">
    <div class="slider-wrapper">
        <div id="slider">
            <div class="slide1">
                <img src="images/slide_1.jpg" alt="" />
            </div>
            <div class="slide2">
                <img src="images/slide_2.jpg" alt="" />
            </div>
            <div class="slide3">
                <img src="images/slide_3.jpg" alt="" />
            </div>
            <div class="slide4">
                <img src="images/slide_4.jpg" alt="" />
            </div>
        </div>
        <div id="slider-direction-nav"></div>
        <div id="slider-control-nav"></div>
    </div>
</section>
<!-- Slider Script -->
<script type="text/javascript">
    $(document).ready(function() {
        var slider = $('#slider').leanSlider({
            directionNav: '#slider-direction-nav',
            controlNav: '#slider-control-nav'
        });
    });
</script>
 <!-- End Slider Script -->
<section class="about-box">
    <div class="about-boxtitle">TITLE HERE</div>
    <div class="about-boxline"></div>
    <div class="about-boxtext"></div>
</section>

<section class="news-box">
    <div class="news-boxtitle">NEWS</div>
    <div class="news-boxline"></div>
    <div class="news-boxtext"></div>
</section>

<section class="clients-box">
    <div class="clients-boxtitle">CLIENTS</div>
    <div class="clients">client</div>
    <div class="clients">client</div>
    <div class="clients">client</div>        
</section>   

    </article>

The issue lies with the section labeled "clients-box" (the very last section).

Here is the corresponding CSS:

.clients-box {
        width: 960px;
        margin-top: 10px;
        background-color: #FFF;
    }

    ul.clients {
        width: 940px;
        height: 40px;
        margin: 0 auto 0;
    }

    ul.clients li.client {
        width: 150px;
        height: 40px;
        display: inline-block;
        background-color: #039;
        clear: both;

You can view the live website here:

Answer №1

.client-container must have either float: left or float: right. To center it with top/bottom margins of 10px, you can include margin: 10px auto.

Answer №2

The usage of float on the aforementioned <sections> has caused them to not take up space, resulting in this box rising to the top, below the floated elements.

A simple solution would be to also add float: left to this box.

Alternatively, following @Mr. Alien's suggestion, you could simply add clear: left to this block.

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

Creating an interactive table with the power of FPDF and PHP

I have developed a unique Invoice System that allows users to customize the number of headings and fields using FPDF in conjunction with PHP. Subsequently, I can input the heading names and field values into HTML input fields. However, I am encountering a ...

Having trouble displaying DIV Content with CSS through printing

<script type="text/javascript"> function PrintElem(elem) { Popup($(elem).html()); } function Popup(data) { var mywindow = window.open('', 'mydiv', 'height=550,width=750'); mywindow.doc ...

What is a method to position an <img> on top of text without obscuring the text or resorting to CSS background or text-indent

To view the related code snippet, click on this link: http://jsfiddle.net/Ws8ux/ Is there a way to position the text under the logo without hiding it through display:none or text-indent? I am aiming to bring the image up while keeping the logo in the back ...

scraping text content from a CSS node using Scrapy

My goal is to extract a catalog ID number from the following webpage: from scraping.selector import Selector from scraping.http import HtmlResponse url = 'http://www.enciclovida.mx/busquedas/resultados?utf8=%E2%9C%93&busqueda=basica&id=& ...

Can a hyperlink be generated by simply inputting the URL once?

As I add numerous links to my website, I can't help but feel like a novice using the <a href>. I want users to see the URL of each link immediately without needing to hover over it first. Right now, I am structuring my links like this: <a h ...

The aligning property "justify-content: space around" does not behave as expected on a line and does not provide the desired spacing

Below is the HTML code I am working on: <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta na ...

Is it possible to programmatically hide the Textarea and submit button for each row in a PHP-generated database table?

After spending a considerable amount of time on this project, I'm looking to incorporate a JavaScript effect (hide/unhide) into a basic submit form. Although the functionality is successful, it seems to be limited to only one row in the database tabl ...

Is it feasible to create a tabbed layout that is responsive?

Would it be possible to create a layout like this and how would you go about doing it? The container has borders, except at the top where the tabs are located. Only the selected tab should have a border at the top. The text on the tabs should be centered, ...

Conceal four input fields depending on the option chosen from the dropdown menu

I need assistance with hiding multiple input boxes. Although I've tried using if and else, it seems to only work for two of the boxes. My current code is written in regular JavaScript, but I am open to exploring a jQuery solution as well. window.onlo ...

The Angular Material Table experienced a collapse when trying to render over 20 columns simultaneously

Currently, I am experiencing an issue in Angular Version 5 where the Angular Material Table collapses when rendering more than 20 columns. Here is a snapshot of what my table looks like: https://i.stack.imgur.com/MXfvQ.png https://i.stack.imgur.com/XHWgq ...

Error: The PDFJS variable is not recognized when trying to load a PDF file

I've been experimenting with pdf.js to load PDFs into a web application in order to extract information in real-time. However, I keep encountering an error even with a simple example. I've attempted enclosing the code in $(document).ready() as a ...

Enhance the appearance of a custom checkbox component in Angular

I developed a customized toggle switch for my application and integrated it into various sections. Recently, I decided to rework it as a component. However, I am encountering an issue where the toggle switch button does not update in the view (it remains t ...

What is the best way to customize the size of a file upload Buefy component to have both a specific

I am looking to set up a file drop area with the Buefy component, but I want the size of the drop area to be 100% of both the width and height. The basic page is provided below, however, I am unsure about where to add the necessary width and height styles. ...

I am having trouble debugging the Twitter Bootstrap v4-alpha grid. The col-sm-offset-* class doesn't seem to be

Something has been altered somewhere, causing col-sm-offset-*s to stop functioning entirely. For instance, when attempting to split the screen in half and only display content on the right side, I typically would use: <div class="container"> < ...

Can you explain the purpose of using href="#" in web development?

I've noticed that numerous websites use links that have href="#". Can you explain what this means and how it is typically used? ...

Card columns with dropdown extending into adjacent column

Encountering a strange problem with the card-columns layout in Bootstrap when using dropdown menus within the cards. The issue arises when the dropdown-menu divs of the lower cards bleed into the next column, despite appearing in the correct position. Thi ...

Creating a div element with a fixed size that remains the same regardless of its content

Check out the code snippet below for displaying an image and title: <div id="eventsCollapsed" class="panel-collapse collapse" ng-controller="videoController"> <div class="panel-body"> <div ...

How can I customize the styling of an SVG pseudo element using Font Awesome 5?

I've implemented font awesome 5 pseudo elements to attach an :after tag to my element as shown below: &:after { content: "\f068"; font-weight:400; color:$brandRed; float:right; font-family: "Font Awesome 5 Pro"; } The c ...

To prevent the page focus from shifting, make sure to force click on a blank link

My question involves an empty link: <a href="#" id="stop-point-btn">+ add stop-point</a> This link is connected to a JavaScript function: $("#stop-point-btn").bind("click", addStopPoint); The JS function simply inserts content into a specif ...

Is there a way to shift a background image pattern?

After searching extensively, I came up empty-handed and am seeking guidance on how to achieve a specific effect. Specifically, I am in need of a JavaScript or jQuery script that can smoothly shift a background image to the right within a designated div con ...