The use of a CSS3 arrow across various platforms

While coding two arrows on MacOSX, I noticed that they do not display correctly on Windows systems. Could this be due to the resolution or a coding error?

https://jsfiddle.net/m7ynysdp/

<div class="arrow a1"></div>
<div class="arrow a2"></div>

.arrow {
    height: 0;
    border-bottom: 2px solid;
    border-width: 2px;
    position: relative;
    color: #000;
}

.a1 {
    position: absolute;
    top: 51%;
    left: 76%;
    transform: translate(-51%, -76%);
    width: 22vw;
    transform: rotate(-156deg);
    transform-origin: 0;
    border-bottom: 2px solid;
}

.a2 {
    position: absolute;
    top: 53%;
    left: 65%;
    transform: translate(-53%, -65%);
    width: 6.5vw;
    transform: rotate(-111deg);
    transform-origin: 0;
    border-bottom: 2px solid;
    cursor: pointer;
    transition: color .3s;
}

.arrow::before {
    position: absolute;
    top: -13px;
    right: -3px;
    content: '>';
    display: block;
    font-size: 1.4rem;
}

The first arrow is displayed on Mac and the second one is on Windows, both using the latest version of Chrome.

https://i.sstatic.net/QeiRT.png

https://i.sstatic.net/VTEuH.png

Answer №1

There seems to be a slight alignment issue, but adjusting the position to top: -12px; and adding font-weight: bold; solves the problem.

.arrow::before {
    position: absolute;
    top: -12px;
    right: -3px;
    content: '>';
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
}

Check out the fix on JSFiddle here.

To address this for different operating systems, you can modify the code based on user agent:

jQuery(document).ready(function(){
 if(navigator.userAgent.indexOf('Mac') > 0){
  jQuery('body').addClass('mac');
 } else {
  jQuery("body").addClass("pc");
 }
});

Then adjust the CSS accordingly for Mac and PC users:

.mac .arrow:before {

  ...
  top: -13px;

}

.pc .arrow:before {

  ...
  top: -12px;
  font-weight: bold;

}

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

Loading Ajax dropdown with a preselected value in the dropdown menu

There are two pages, each containing a form. Page 1 - Form A) Includes a dropdown menu (with values populated from the database) and a continue button. <select name="form[formA][]" id="dropdown1"> <option value="1">Option 01</opti ...

The Yeoman/Grunt-usemin is failing to update the index.html file even after adding new JavaScript code

As I work on developing a web app using Yeoman and the Angular generator on Windows 7, I go through the process of running 'yo angular' followed by 'grunt' to build the app for deployment. The index.html file in the dist folder gets upd ...

Exploring the functionality of AngularJS routing on a webpage

Testing the routing functionality of AngularJS while creating a web page. The index.html will contain links to Home, Courses, and Students. Clicking on each link will load its respective HTML using AngularJS routing. The student information is stored in ...

Conceal or Reveal Navigation Tabs on Your Website

I recently added a fixed navigation link to my website and also implemented it in the forums and blog section. However, I have noticed that some users find the navigation link to be irritating while browsing the forums. To address this issue, I would like ...

Issue with nested grid layouts within the 960 grid system

I recently started working on a personal hobby website and decided to utilize the 960 css grid system for organizing my HTML elements on the page. After grasping the basic concept, I went ahead and created a preliminary version of the website, which is ho ...

Discovering the Xpath for a checkbox within a <div><input> combo using Selenium

Is there a way to successfully click on the checkbox with the provided code? I've attempted using the xpaths below, however, they are unable to locate the checkbox and do not display any errors in the console. driver.findElement(By.xpath("//*[@id=&ap ...

The Angular integration with Semantic UI dropdown does not display the selected value clearly

I have put together a small example to demonstrate the issue. http://plnkr.co/edit/py9T0g2aGhTXFnjvlCLF Essentially, the HTML structure is as follows: <div data-ng-app="app" data-ng-controller="main"> <select class="ui dropdown" id="ddlStat ...

Minimize or conceal iframe

This iframe contains a Google form that cannot be edited. I am looking for a way to close or hide this iframe, either through a button, a popup window button, or without any button at all. The $gLink variable holds the Google form link through a PHP sessio ...

Experiencing an unexpected issue with Firefox? Seeing unexplained strokes on an image that are not present on other browsers

Currently, I am working on customizing a file input to display its content using a preview <img> tag. <div id="image_preview"> <input> ..... <img id="preview" src="" class="img-fluid" alt=""> </div> While it displa ...

Using functions like nl2br() for new line breaks, preg_replace for replacing patterns, htmlspecialchars() for encoding special

I've reviewed all the answers on this topic, but I'm still struggling to find the correct method for sanitizing data. My task is to enter: <?php echo 'yes'; ?> <?php echo 'yes' ?> into a text area, submit it in ...

What could be causing the HTML <DATALIST> dropdown to display next to its input rather than below it?

I have an input linked to a datalist, and it's functioning correctly. However, when I initially open the dropdown, the option list appears next to (right of) the input. After entering a few characters to narrow down the list, it then shifts below the ...

Design a big-sized button using Bootstrap framework

Is there a way to design a big, responsive button using Bootstrap? Similar to the example image linked below https://i.sstatic.net/xEBwc.png ...

Issue caused by overflowing content and resizing the display

I am facing a challenge with my website. Essentially, my webpage has the <html> set to overflow:hidden, with two horizontal navbars, a fixed vertical sidebar on the left, and a central div with the height: 90% property. Edit: The container div now ...

The amazing feature known as "CSS3 background-clip"

Seeking a solution for restricting a background image to the text within an h2 element using -webkit-background-clip. Wondering if -moz-background-clip functions in the same way as -webkit-background-clip. As it currently only works in webkit browsers, it ...

Tips for extracting links from a webpage using CSS selectors and Selenium

Is there a way to extract the HTML links per block on a page that renders in JavaScript? Would using CSS or Selenium be more effective than BeautifulSoup? If so, how would I go about utilizing either of those methods to achieve the extraction of the HTML ...

"Create a Single-Page Bootstrap Website with a Responsive Design showcasing PHP Code within the Contact Form

Working on the final touches of a single-page responsive website project for a client. Utilizing a Bootstrap contact form located at the bottom of the HTML document. The PHP code is unexpectedly displaying in the text fields of the contact form. I've ...

Insert a gap between the File Input button and the Placeholder text

https://i.sstatic.net/Gnm6u.png I'm currently attempting to create a separation between the "Choose File" button and the "No file chosen" area, similar to what is shown in the image above. Below is the HTML code I am using: <p class="mb-0 f- ...

Anomalies encountered during the iteration of a table

As I work on building a table by looping through an API array, I've encountered a few obstacles. Here is the code snippet that's causing me trouble -> $html = " <tr class='mt-2'> <td>{$rank}.</td> ...

IE Versus FF: Exploring Variances in Cascading Style

Hey there! I have a question regarding my current project. When viewing my page here in Firefox and Internet Explorer, I noticed that the width of the main content boxes is different. In Firefox, everything lines up perfectly with the advertisement at the ...

Exchange one HTML element with a different HTML element

I've been attempting to change an HTML tag using PHP or jQuery. The current default tag is: <li class="dropdown"> <a href="index.html" class="dropdown-toggle"> Home</a></li> My desired replacement for the above HTML tag is: ...