arrangement of rows and columns within Bootstrap 3 framework

I am attempting to display the name 'test' three times in a row and three times in the second row, but it is not appearing horizontally as intended.

Instead, everything is displaying in a vertical column pattern...


    <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css">
<title>bootstrap</title>

<div class="services container">
    <h2>Services</h2>
    <div class="row">
        <section class="col-md-6 col-md-4">
            <img class="icon" src='images/cabbage.png' alt="Icon">
            <h3>Vegitables</h3>
            <p>Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.</p>
        </section>
        <section class="col-md-6 col-md-4">
            <img class="icon" src='images/car.png' alt="Icon">
            <h3>Cars</h3>
            <p>Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.</p>
        </section>
        <section class="col-md-6 col-md-4">
            <img class="icon" src='images/clothes.png' alt="Icon">
            <h3>cloths</h3>
            <p>Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.</p>
        </section>
    </div>
    <div class="row">
        <section class="col-md-6 col-md-4">
            <img class="icon" src='images/motorcycle.png' alt="Icon">
            <h3>Motorcycle</h3>
            <p>Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.</p>
        </section>
        <section class="col-md-6 col-md-4">
            <img class="icon" src='images/pet-icon.png' alt="Icon">
            <h3>Pets</h3>
            <p>Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.</p>
        </section>
        <section class="col-md-6 col-md-4">
            <img class="icon" src='images/phone.png' alt="Icon">
            <h3>Phone</h3>
            <p>
                    Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.
            </p>
        </section>
    </div>
</div>


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

//my css code

    .icon{
        max-width: 150px;
        margin: 0 auto;
        display: block;
    }
    .service section{
        text-align: center;
    }

Is there any way to make this code work as intended? Are there any necessary corrections or suggestions?

Answer №1

To utilize the bootstrap grid system, you need to incorporate their CSS styles.

Place the following code in your <head> section:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Your code looks good and should function properly once you do that.

Answer №2

It looks like your code is correct, but you may need to consider different screen resolutions. I have added the col-xs-4 class to help with rendering on smaller screens. You can explore Bootstrap's grid system options here for more information.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

 <div class="container">//main container
            <h2>Services</h2>
            <div class="row">//1st row
                <section class="col-xs-4 col-md-4 col-md-6">
                    <h2>Test</h2>
                </section>
                <section class="col-xs-4 col-md-4 col-md-6">
                    <h2>Test</h2>
                </section>
                <section class="col-xs-4 col-md-4 col-md-6">
                    <h2>Test</h2>
                </section>
            </div>
            <div class="row">//2nd row
                <section class="col-md-4">
                    <h2>Test</h2>
                </section>
                <section class="col-md-4">
                    <h2>Test</h2>
                </section>
                <section class="col-md-4">
                    <h2>Test</h2>
                </section>
            </div>
        </div>

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

Ways to Personalize Navbar in the Bulma Framework

How can I make the <router link> element in my navbar component full width? I'm also looking for keywords related to achieving this layout. Here is an image of the issue: https://i.sstatic.net/2f2b0BcM.png I want a layout that spans the full ...

What is the best way to implement autoplay sound on a JavaScript webpage?

I'm currently working on a web system aimed at monitoring values from a database, and I have the requirement to trigger a sound alert when a specific range of values is received. Despite trying various examples found online, none of them have been suc ...

Loading a different webpage seamlessly without having to reload the current one

Here is a snippet of my code in okay.html: {% extends "sch/base.html" %} {% load staticfiles %} {% block content %} <div class="row" id="ada"> <form action="" method="post> {% csrf_token %} <div align="center" class="cont ...

Show / Hide content by clicking another div

I need help figuring out how to create a collapsible div that expands and collapses when a different div is clicked. The expanding/collapsing effect that I've been experimenting with is similar to what I want, but I'm not sure how to modify the c ...

Header and footer that remain in place while the content scrolls smoothly

I'm currently working on designing a webpage that includes three separate divs: a header, a footer, and a content area. These divs are intended to fill up the entire screen space available. The header and footer remain consistent in size and structur ...

Customizing a Tab Bar with HTML and CSS - Adjusting the text color for the selected tab

When creating a set of radio buttons with labels using HTML, the challenge arises when the active tab appears in blue with white text while the inactive tabs have the same white text making them invisible until highlighted. The goal is to change the color ...

Arranging divs precisely while rotating a Bootstrap Thumbnail

I've been experimenting with creating a "css3 on hover flip" effect for bootstrap thumbnails. It works perfectly fine on simple divs (check it out here) Here's the main CSS3 code I'm using: .front{ position:absolute; transform:pers ...

Learn the trick to making specific words appear bold in Select2 by changing the font style

I'm currently working with select2 version 4.0.1, and I have a requirement to modify the font for specific words. In particular, I want to display codes AK and HI in a different/bolder font style, similar to the example below: <select id="select2" ...

What is the best way to make a fixed div appear when a user scrolls down the page, similar to Facebook

As I was scrolling down on Facebook, I noticed that the ads divs stay fixed when they reach the bottom. Has anyone figured out how to achieve this effect? I believe it can be done using a combination of JavaScript and CSS. Does anyone have the code for im ...

Matching an apostrophe in an AutoHotkey script using regex

My autohotkey script is designed to search for a word in a bilingual dictionary when I double click on any word within a webpage. However, I am facing an issue where the script also copies the characters preceding the apostrophe when clicking on words like ...

Using Bootstrap 4 to create columns with fixed width and displaying the rest of the line in the card-footer

I have a bootstrap-4 card containing a footer. The footer consists of a fixed-width input field and a button. The button needs to expand to the width of 100% minus the width of the input field. https://jsfiddle.net/aq9Laaew/224543/ input { width:3rem; ...

Having trouble with script tag not loading content in Next.js, even though it works perfectly fine in React

Currently, I am attempting to utilize a widget that I have developed in ReactJS by utilizing script tags as shown below- React Implementation import React from "react"; import { Helmet } from "react-helmet"; const Dust = () => { ...

Having trouble making my if / else statement show the_header_image_tag on WordPress

Having some trouble getting my if / else statement to function correctly. I am using a WordPress function called '' and I want to apply different CSS styles based on whether it is used or not. My theme allows for the display of a banner, but onl ...

Tips for adding a placeholder in a login form on Drupal 7

Can anyone help me set a placeholder for a horizontal login form in Drupal 7? I want the placeholder text to disappear when clicked on, and I want it to display 'username' and 'password'. Here is the current code for the form. Thank you ...

In Bootstrap 4, IE 11 struggles with images overflowing within a d-flex div containing an img tag

My webpage utilizes the bootstrap 4 grid system and appears correctly on most browsers, except for IE 11. If you check out this snippet on jsfiddle in IE 11, you'll notice that the image gets stretched inside a d-flex container. How can I resolve this ...

Issue with Bootstrap container's max-width not functioning

After implementing the code in the following manner: <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> <link href="css/bootstrap-responsive.css" rel="stylesheet" type="text/css"> <style type="text/css"> .con ...

The impact of adjusting the article's margin-top on the margin-top of

I want these two divs to have different positioning. The sidebar should remain fixed at the top. Why is the sidebar aligned with the article div instead of sticking to the top? body{ margin: 0; padding: 0; } div#sidebar{ background-color: yel ...

Having trouble getting Bootstrap CSS to work with ASP.net?

After using the bootstrap alerts class, I noticed that the view is not what I expected - https://i.sstatic.net/HqAFV.jpg Instead of that, I tried - https://i.sstatic.net/hooZy.jpg To fix this issue, I included the reference under the head tag like so: ...

Enhance class names by utilizing addEventListener within the useEffect hook

I'm having trouble with creating a hamburger button menu. The issue I'm facing is that when I click the button, nothing happens. Even though I can log something in the toogleHamburger function and see it in the console, the styling does not chang ...

There seems to be a problem with how the navbar is being displayed in ResponsiveSlides.js

I am currently using WordPress, but I have come here seeking help with a jQuery/CSS issue. I am utilizing responsiveSlides.js to create a simple slideshow, however, when viewing it here at gallery link, it appears that something is not quite right. STEPS: ...