Position Ionicons center above h3 header in Bootstrap

My icons keep aligning to the left:

<section class="section-what-i-do">
    <div class="container">
      <h2>What I do</h2>
      <p class="sub-header" id="learn-more-section">Studying, creating, learning</p>
      <div class="row">
        <div class="col-md-4">
          <i class="ion-ios-monitor-outline icon-large"></i>
          <h3>Computer Science</h3>
        </div>


        <div class="col-md-4">
          <i class="ion-ios-cloudy-outline icon-large"></i>
          <h3>Web development</h3>
        </div>


        <div class="col-md-4">
          <i class="ion-ios-bolt-outline icon-large"></i>
          <h3>Learning new tech</h3>
        </div>

      </div>
    </div>
  </section>

Css:

.icon-large{
  font-size: 350%;
  text-align: center;
  margin: 0 auto 10px auto;
  color: #e74c3c;
}

I prefer using ionicons fonts over Bootstrap glyphicons.
The icons seem to be aligned to the left, giving the impression that there might be a float: left in the code somewhere.

Answer №1

Make sure to apply the text-align:center property to the parent div...

Since your icons are set to display:inline by default, they may not be affected by the use of margin.

.icon-large {
  font-size: 350%;
  color: #e74c3c;
}

.col-md-4 {
  text-align: center;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" />
<section class="section-what-i-do">
  <div class="container">
    <h2>What I do</h2>
    <p class="sub-header" id="learn-more-section">Studying, creating, learning</p>
    <div class="row">
      <div class="col-md-4">
        <i class="ion-ios-monitor-outline icon-large"></i>
        <h3>Computer Science</h3>
      </div>
    </div>
  </div>
</section>

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

Storing css data for iPhone Facebook application

Currently, I am in the process of developing a webpage specifically for the iPhone Facebook app wall link. Interestingly, when attempting to apply the margin attribute to a div within the webpage, the margin doesn't seem to have any effect when clicki ...

What is the best way to ensure the main container fills the entire screen?

Given: Bootstrap 5.1 Visual Studio 2022 Professional Edition Blazor Server Application How do I modify the container to occupy the entire screen without any margins? <div class="container bg-primary"> Hello World! </div> Thi ...

Executing functions with directive controllers

Is there a simple way to call a function on a directive controller by accessing the instance using its id from the parent controller? <my-directive id="id1" /> var dirController = getDirectiveByID("id1"); dirController.someFunc(); If you have any ...

Is it possible to adjust the height of sibling divs within a sequence to match the tallest div?

Do you have a set of inline div containers with hardcoded widths but varying content heights? Is there a way to ensure that all divs maintain the same height without risking content overflowing from its parent container? I've experimented with inher ...

Combining selected boxes through merging

Looking to create a simple webpage with the following requirements: There should be 10 rows and 3 boxes in each row. If I select 2 or more boxes or drag a box, they should merge together. For example, if my initial screen looks like this: and then I se ...

Dompdf is outputting the HTML Bootstrap code as col-sm-x instead of col-lg-x

Currently, I am utilizing Dompdf in my PHP project to generate PDF reports. However, I have encountered an issue where the HTML bootstrap code does not render as expected on the PDF document. Specifically, when viewing the grid on a smaller device, it coll ...

How to extract JSON data without HTML tags in Android Studio

i'm done with my android studio project. i have successfully stored data from wp-json. however, there seems to be an issue where I am getting the following: <p>আল্লামা আহমদ শফীর ইন্তেকালের পর ...

What is the best way to implement spacing between the navigation bar logo, search bar, and links using flex in Bootstrap 5?

I want to customize the layout of my navigation bar using Bootstrap 5. Specifically, I would like the logo text to be on the left, the search bar in the middle, and the user links on the right. How can I achieve this using Bootstrap 5? <!-- NAVIGATION ...

Navigating through dropdown menus using webdriver

I am having trouble selecting a specific element from a dropdown menu. The element I am trying to select is labeled Edit/ViewResume 1st Attempt For my initial try, I attempted to use the Action and Select class methods to choose the desired webelement ...

Running a JavaScript function within a designated div element

I'm currently facing an issue with executing a javascript function - onload only in a specific div. I seem to be stuck on this problem, so if anyone could offer some assistance, I would greatly appreciate it. Thank you very much in advance! functio ...

Combine and interchange horizontal and vertical form designs within antd 5 for a personalized touch

I need to customize the layout of a form to display checkboxes in vertical mode. Specifically, there is a row of checkboxes that I want to appear vertically aligned rather than horizontally. In the past, I was able to achieve this in antd 4 by applying a ...

Solution for tables extending beyond the navbar and footer issue

My table is extending beyond the width of both the navbar and footer. Is there a way, using HTML and CSS, to make the navbar and footer expand in width to match that of the table? Most solutions I've found focus on formatting the table instead of addr ...

Discrepancy in Line Spacing in Internet Explorer 9 when Working with TextAreas

My TEXTAREA requires precise spacing, so I've set the formatting as shown below: TEXTAREA { font-family: Tahoma, Arial; font-size: 8pt; letter-spacing: 0px; line-height: 13px; } The issue arises when typing text into the textarea - the li ...

The vertical alignment of floated elements in HTML is not correctly positioned

The result of the code is not as expected. The right section should be aligned with the left, but it appears below instead. This is the code I am using: <!-- footer begin --> <footer> <div > ...

Show a virtual numeric keypad on the HTML input fields when they are set as type text specifically for mobile devices in a unique situation

When accessing the following web page from a mobile device, I currently have number input fields with comma separators added. However, in order to implement the comma separation function, I had to set the input type to text. This resulted in showing an alp ...

Can a CSS <div> element have margins applied to it?

Can a margin be defined for a text area? My WYSIWYG editor wraps my text within <div> tags instead of using line breaks <br /> So I was thinking of adding a margin to the <div> tag? Is this possible in CSS? If so, how can it be done? ...

Div sliding out of view

I'm encountering a slight issue with this template: essentially, my goal is to implement a feature where clicking on a box will expand it while simultaneously sliding the other boxes off-screen. However, instead of just sliding the div off-screen, it ...

Adjust the x-scroll to continue infinitely while deactivating the y-scroll

https://i.sstatic.net/KmDTe.png Is there a method in CSS to prevent vertical scrolling and have all the contents of a div positioned next to each other so that they extend beyond the visible browser window? I would like to enable horizontal scrolling to b ...

Challenging jQuery AJAX journey

After tirelessly searching the web, I am still unable to solve this issue and cannot understand why it is not functioning. My JavaScript code seems to work only on Firefox and fails to run on any other browser. So, I have made the decision to switch to j ...

Spinning with animation in jQuery

Greetings! I am in the process of creating a popup box that will appear upon clicking the Login button. My aim is to produce a popup box with a rotating effect, however, my attempts have not been successful so far. You can view the code snippet on JsFidd ...