Stylish Fonts with Bootstrap 4 and Font Awesome

I've encountered a little issue. I'm attempting to horizontally center each icon within a div, but my attempts so far have been unsuccessful.

<div class="row">
  <div class="bg-inverse p-x-1 col-xs-12  default-1 ">
    <div class="row">
      <div class="col-xs-2  offset-xs-2">
        <i class="fa fa-facebook-square m-x-2 fa-3x p-y-1" style="display:center" aria-hidden="true"></i>
      </div>
      <div class="col-xs-2 offset-xs-1">
        <i class="m-x-2 fa fa-twitter-square fa-3x p-y-1" aria-hidden="true"></i>
      </div>
      <div class="col-xs-2 offset-xs-1">
        <i class="m-x-2 fa fa-youtube-play fa-3x p-y-1" aria-hidden="true"></i>
      </div>
    </div>
  </div>
</div>

Answer №1

Give this approach a try. I have eliminated the m-x-2 classes from the icons and included text-xs-center in their containers. This adjustment is intended to align inline elements such as the font awesome icons. Keep in mind that there is no center value for the display property.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="sha384-2hfp1SzUoho7/TsGGGDaFdsuuDL0LX2hnUp6VkX3CUQ2K4K+xjboZdsXyp4oUHZj" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js" integrity="sha384-VjEeINv9OSwtWFLAtmc4JCtEJXXBub00gtSnszmspDLCtC0I4z4nqz7rEFbIZLLU" crossorigin="anonymous"></script>

<div class="row">
  <div class="bg-inverse p-x-1 col-xs-12  default-1 ">
    <div class="row">
      <div class="col-xs-2  offset-xs-2 text-xs-center">
        <i class="fa fa-facebook-square  fa-3x p-y-1" aria-hidden="true"></i>
      </div>
      <div class="col-xs-2 offset-xs-1 text-xs-center">
        <i class=" fa fa-twitter-square fa-3x p-y-1" aria-hidden="true"></i>
      </div>
      <div class="col-xs-2 offset-xs-1 text-xs-center">
        <i class=" fa fa-youtube-play fa-3x p-y-1" aria-hidden="true"></i>
      </div>
    </div>
  </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

The specified number of columns and width values are being disregarded

The Challenge While using the CSS column-property to create columns on my webpage, I have encountered some unusual behavior with the layout engine. Specifically, I have set up the following styling: body { padding: 0; background-color: black; margi ...

The beauty of Aurelia's scoped CSS

Embarking on my Aurelia journey, I find myself navigating through the vast world of web development with tools like nodejs, gulp, and more. The Aurelia CLI has made it convenient for me to set up a visually appealing Aurelia project in Visual Studio Code ...

What is the method for updating the content within a div element?

I am trying to add multiple elements to my content, including an h1 element, an input field, and some buttons. I have written a function to create the h1 and input elements, but when trying to add them to my content div, I encountered an error (TypeError ...

CSS: flexible side panels with stationary center

I am looking for a specific layout that consists of three columns: left, content, and right. The left and right columns will each have an image, with the left column image aligning to the left edge of the browser and the right column image aligning to the ...

Remove all of the classes from the specified element using JavaScript

I have a button and I want to remove all the classes when it is clicked. Here is what I have tried: button.style.className = '' document.querySelector('button').onclick = function() { this.style.className = ''; } .myClas ...

What are some effective ways to align an image to the left and text to the right within a table

I need to display a member with a higher rank, showing the user image along with their username. However, I am struggling to align the image and text properly due to varying username lengths causing them to appear in a zig-zag position. Here is what I hav ...

Utilizing headless WordPress and React for an innovative web development approach, incorporating styles seamlessly in both the

I am looking to create a headless WordPress + React website. So far, I have successfully set up the "non-gutenberg" elements like the header and footer. Everything seems to be working fine on that front. However, I am facing an issue with the styling of t ...

Stopping the spread of popup alerts: A comprehensive guide

I'm having trouble explaining this in English;-) Whenever I select an option, an alert pops up for each choice and I don't know how to stop it. Step 1: Choose the "aaaa" option, for example 1111 alert ... Step 2: Choose the "bbbb" option, for ...

Implement JQuery UI Accordion to enhance navigation on mobile devices

I am implementing the JQuery UI Accordion to expand content on a website. Below is the basic markup structure: <div class="accordion"> <h2>Heading</h2> <div>Content</div> <h2>Heading</h2> <div& ...

Utilize Bootstrap 4 to seamlessly integrate a small element between two lengthy items in a row, ensuring a gap

I would like to achieve a similar look to this design. https://i.sstatic.net/p1hq4.png hr { border: none; color: black; background-color: black; height: 5px; margin-top: 10px; } <div class="row code-line"> <div class="col-5 ...

Is it possible to verify .0 with regular expressions?

In my project, I have a field that requires whole numbers only. To validate this, I used a regex validation /^\d{1,3}$/ which successfully validates whole number entry and rejects decimal points starting from .1. However, I encountered an issue where ...

Attempting to apply two different animations to a single element

Trying to implement two different animations, with one triggering before the other. In the Codepen and snippet below, you can observe that the initial animation rearranges the icons to their original positions upon page load. The second animation involves ...

Adjust the container within the column to match the height of the column in the bootstrap grid

Why is the green container expanding over the blue column when I apply height: 100% or h-100? Is there a way to make it fit just the remaining height of the column? <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstra ...

HTML/CSS - Enhances user experience by zooming in on select tag when tapped on mobile devices

I am experiencing an issue with a select menu on mobile devices. Whenever I tap on the menu, it seems to zoom in slightly. Is there a particular -webkit property causing this behavior? How can I prevent the screen from zooming when I tap on the select me ...

Importing text data from a text file in Java or jQuery without the need for a web server

I've attempted to utilize both the jQuery.Get() and $.Get() methods for this task, but they don't seem to be working as expected. <head> <script type="text/javascript" src="jquery-2.1.3.min.js" > </script> <script lang ...

What is the best way to stack three boxes on top of one another in Nextjs Tailwind?

Currently, I am working on creating a design with 3 boxes stacked vertically and then adding an image to it. You can see the example below: https://i.sstatic.net/jViO.png I have successfully implemented this layout, but I am facing an issue where the box ...

Is it possible to verify the presence of an ID with jQuery?

Is it possible to check for the existence of the id 'input-name' before assigning a value to the variable name using a line of code similar to this: var name = $('#input-name').attr("value"); In case the id 'input-name' does ...

When attempting to access http://localhost:3000/highLightTitle.png using Next.js, a 404 error (Not Found) was encountered in the content

Despite not having any mention of GET http://localhost:3000/highLightTitle.png in my Next.js project code, I am encountering an error related to this issue. The error can be viewed here, and specifically at line 199 in content.js which can be seen here. T ...

What is the best way to extract pricing information from Udemy?

Important: I haven't been able to find a relevant solution in similar questions. How can I extract prices from Udemy using web scraping? Scraping Data From Udemy's AngularJs Site Using PHP How do I obtain promotional prices using the Udemy API ...

Using Angular directives to pre-select a default option

I am currently working on a select HTML tag with two options, and I want to set the first option as the default choice. My select element includes Angular directives like ng-change and ng-model. I have attempted to achieve this by adding selected = "select ...