Problem with Bootstrap 4 and image centering

Hello, I have decided to build a website with Bootstrap 4, just to test it out.

I am having trouble with as simple a task as centering an image, though.

This is the full code:

<!doctype html>
<html class="no-js" lang="it">

<head>
    <title>Prova</title>

    <!-- BOOTSTRAP 4 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <script src="js/vendor/modernizr-3.5.0.min.js"></script>
    <script src="js/vendor/jquery-3.2.1.min.js"></script>
    <script src="js/vendor/popper.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>

</head>

<body>

        <div class="container">
            <div class="row">
                <div class="col-xs-12">
                    <div class="text-center logo">
                        <img class="img-fluid" src="img/logo/logo800.png">
                    </div>
                </div>
            </div>
        </div>

</body>

</html>

Open in new window


And this is the test page on my server:
http://test.ilgufoblu.net/ferrari/prova.html

I haven't been able to find a single reason why this image shouldn't be centered, with the text-center class assigned to its containing div.

Can somebody help me understand this?
Daniele BrunengoIT Consultant, Web DesignerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
In your HTML you have added the col-xs-12 class to your column div:

<div class="col-xs-12">

This has been dropped in Bootstrap 4. You need to use col-12 instead:

<div class="col-12">
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Thanks! But has the xs label been dropped altogether, or just for a 12 column row, where it actually is no use?
0
Chris StanyonWebDevCommented:
Yeah - the xs has been dropped. Basically, Bootstrap is designed to be mobile first, so effectively, the xs size is the defualt, so there's no need to specify it. You only need to specify the breakpoints for larger sizes, so for columns, you have:

// single column on XS devices / 2 columns on SM
<div class="col col-sm-6">content</div>
<div class="col col-sm-6">content</div>

// 2 columns on XS / 3 columns on SM
<div class="col-6 col-sm-4">content</div>
<div class="col-6 col-sm-4">content</div>
<div class="col-6 col-sm-4">content</div>
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Chris StanyonWebDevCommented:
sorry - above code should be col-12, not col for the single col:

<div class="col-12 col-sm-6">content</div>
<div class="col-12 col-sm-6">content</div>
0
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Thanks again.
0
lenamtlCommented:
To center an image you will need Bootstrap helper
https://v4-alpha.getbootstrap.com/content/images/#aligning-images

To center an image here is the code
<img src="..." class="mx-auto d-block" alt="...">

Open in new window

or
<div class="text-center">
  <img src="..." alt="...">
</div>

Open in new window

1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.