Search code examples
twitter-bootstrap-3gridrowcol

Bootstrap columns aren't side by side


I'm trying to learn Bootstrap Grids, I think I did the correct use of Grids but my code isn't producing the result I expected in Chrome, although it looks correct in Codepen. My code:

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <title>Testando Grids</title>

        <!-- Bootstrap -->
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/bootstrap-responsive.min.css">

        <!-- CSS -->
        <style type="text/css">
            .red {
                background-color: red;
            }
            .blue {
                background-color: blue;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="red col-md-8">8</div>
                <div class="blue col-md-4">4</div>
            </div>
        </div>

        <script src="js/jquery-3.2.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
    </body>
</html>

What I expected (and what I get in Codepen):

Expected result using Bootstrap Grid What I've got: Result using Bootstrap Grid


Solution

  • your code is fine, but you have given a wrong bootstrap.min.css path , check your console, here is your updated code, view in full page

      .red {
                    background-color: red;
                }
                .blue {
                    background-color: blue;
                }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
    <link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
    
         
       
            <div class="container">
                <!-- Stack the columns on mobile by making one full-width and the other half-width -->
                <div class="row">
                    <div class="red col-md-8">8</div>
                    <div class="blue col-md-4">4</div>
                </div>
            </div>