Ensuring the endpoint of a right chevron Font Awesome icon aligns perfectly with the edge of a div

Is there a way to position a font-awesome chevron icon or right arrow icon in such a way that its point touches the edge of the containing div perfectly? Despite using text-align: right, the icon still seems to have some spacing to the right preventing it from aligning with the edge. How can this spacing be controlled?

Below is an example code snippet where the issue can be observed. The sidebar does not align perfectly with the edge due to the extra space on the right side of the icon. Is there a solution to remove this spacing and achieve a perfect alignment?

.wrapper {
  height: 100vh;
  display: flex;
  flex-direction: row;
}

.sidebar {
  flex: 00 50px;
  background-color: #ccc;
  text-align: right;
}
.content {
  flex: 1;
  background-color: #000;
}
<link href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" rel="stylesheet"/>
    <div class="wrapper">
          <div class="sidebar">
      <i class="fas fa-chevron-right"></i>
    </div>
    <div class="content">
      
    </div>
    </div>

Answer №1

Here's a simple solution for you! Just create a class called .fa-chevron-right and apply margin-right: -2px;

You can adjust the -2px value to customize the spacing according to your preference!

.wrapper {
  height: 100vh;
  display: flex;
  flex-direction: row;
}

.sidebar {
  flex: 00 50px;
  background-color: #ccc;
  text-align: right;
}
.content {
  flex: 1;
  background-color: #000;
}
.fa-chevron-right {
  margin-right: -2px; 
}
<link href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" rel="stylesheet"/>
    <div class="wrapper">
          <div class="sidebar">
      <i class="fas fa-chevron-right"></i>
    </div>
    <div class="content">
      
    </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

Definitions that are displayed dynamically when hovering over a particular element

I am seeking a way to implement popup definitions that appear when a div is hovered over. My website showcases detailed camera specifications, and I want users to see a brief definition when they hover over the megapixel class called '.mp'. One o ...

Angular JS does not display the bold tag for specific words

I'm currently working on an Angular JS application and receiving text from the server that needs to be displayed on my website. The text received from the server is: "My name is <b> John </b>" with b tags. Unfortunately, when I display ...

Loading AJAX content within the existing page instead of a pop-up window

My goal is to have the page links load in a popup, but after adding this script, the page loads at the bottom instead. How can I make it open in a popup window instead? $('a[rel="ajax:jmodal"]').click(function(event) { $.ajax({ url: $(this).a ...

Reverting a concealed segment

Can anyone make sense of my unconventional explanation? I've set up a hidden section as shown below: <section class="intro"> <label> <input type="checkbox"> <span class="menu"> <span class="hamburger"></span&g ...

I have 4 divs and I need to make sure that 2 of them are centered

I currently have a setup with four divs within a container structured as follows: <div class="container"> <div class="block"></div> <div class="block"></div> <div class="block"></div> <div class ...

JSFiddle showcasing the Bootstrap grid system

I'm having trouble implementing bootstrap's grid system on jsfiddle. Check it out on jsfiddle I've tried using the example from the bootstrap documentation: <div class="row"> <div class="col-md-1">.col-md-1</div> ...

tips for creating a jquery/css scales animation

I am looking to implement a unique feature on my website where I create scales with a balancing effect. The scales should mimic an up and down motion continuously. You can see an example of what I'm referring to here Is there a way in jQuery or CSS t ...

Obtain the text that is shown for an input field

My website is currently utilizing Angular Material, which is causing the text format in my type='time' input field to change. I am looking for a way to verify this text, but none of the methods I have tried give me the actual displayed text. I a ...

The Window.print() function may experience compatibility issues across different browsers

When attempting to utilize the Window.print() function, I encountered an issue where it works perfectly in Google Chrome but not in Mozilla Firefox. Attached are screenshots displaying the problem at hand. What could be causing this discrepancy? Furthermor ...

Mastering the application of map, filter, and other functions in Angular using Observables

After creating this Observable: const numbers$:Observable<any>=Observable.create((observer)=>{ for(let i=0;i<5;i++) observer.next(i); }) I attempted to use map and filter as shown below: numbers$.pipe(map(x=>{x+110})).subscr ...

Tracking Time Spent in a Tab using HTML and JavaScript

I have a unique issue that requires a specific solution. Despite my extensive search across the internet, no useful answers were found. This is the snippet of HTML code in question: <form action="/timer.php" method="POST"> <span>Fir ...

What is the best way to adjust the sizes of two images within the same class to your liking?

My class called cbImage has a fixed CSS for all images. .cbImage img { width: 100%; height: 100%; } However, I don't want all images to have the same width and height. Is there a way to change the width and height of different images as need ...

What is the best way to get this paragraph element to rise upwards?

Everything in my code is working perfectly except for the last paragraph tag. I need to position it in the center of the blue rectangle created by the div with class "defaultButtonStyle." I've tried using margin-top in the CSS without success. Any oth ...

internet explorer 11 not properly aligning text to center

I've encountered an issue with center-aligning a canvas and overlapping image on different browsers. While Chrome and Firefox display it correctly, Internet Explorer does not cooperate. The canvas is not centered, but the image is. I've tried var ...

Issue with Jquery function not triggering due to HTML being injected after the initial load

Apologies for the unclear title. I am currently using a Twitter Bootstrap Modal to edit a record. <a class="contact" href="#" data-form="/edit/models/sms/{{ @value['fields']['id'] }}" title="Edit"> <span class="fa-stac ...

Assistance needed with CSS - making an element occupy the entire remaining vertical space

Although I'm quite confident in my CSS/XHTML abilities, this particular issue has me stumped. You can view the problem here: - (please note that the website is still under development, most features are not functional, and it's subject to frequ ...

Having trouble loading IE with jQuery isotope

Encountering a common issue on an unfamiliar browser, many still face the challenge. Setting up an isotope grid on websites seems to function seamlessly across various browsers, except for when testing in Internet Explorer using . In this case, the layout ...

Issues with Bootstrap Contact Form submission

I found a helpful tutorial for creating a form at the following link: After following the tutorial, I added these scripts to the bottom of my contact form HTML: <script src='https://code.jquery.com/jquery-1.12.0.min.js'></script> ...

Issue with background repetition in CSS

I'm looking to stretch a background image along the left margin of my webpage. Here's the CSS I'm using: body, html{ height:100%; } #content{ background:url(../images/leftBorder.png); background-repeat:repeat-y; height:100% ...

Automating the process of running npm start on page load: A guide

Recently, I've been delving into learning npm in order to incorporate it into a website. I'm curious about how exactly it is used within a website - do you typically need to execute the command "npm start"? How does this integration work for a li ...