Unusual styling: Unexpected CSS :after impact on card layouts in Bootstrap 4

I'm currently utilizing a Bootstrap 4 masonry card layout for a particular project, and within this project, there is a <select> element that has been styled with custom CSS properties. One of the customized styles includes a caret created using CSS's :after pseudo-element. However, I have noticed that different browsers are rendering this element differently, leading to inconsistent results. I decided to share this issue here in the hopes that someone might have a solution. I am uncertain whether this discrepancy is due to a problem with Bootstrap or a CSS specification issue, so any insights would be greatly appreciated.

  • Chrome Canary: the appearance is consistent
  • Chrome: the first column displays correctly, but subsequent columns exhibit issues, except in the mobile view where it appears as intended. The problem seems to occur only with multiple columns.
  • Firefox: everything appears as expected
  • Safari: the caret and text are visible in the first column, but they are missing in subsequent columns.

For reference, here is a link to the Codepen: http://codepen.io/derekshull/pen/GZQaRY

.select-fancy {
  display: inline-block;
  border: 1px solid #bac2c6;
  position: relative;
  padding: 5px 10px;
  border-radius: 20px;
  width: 100%;
  overflow: hidden;
  color: #656565;
  box-shadow: inset 0 -2px 5px rgba(255, 255, 255, 0.4);
  background: #eee;
}

.select-fancy,
.select-fancy > * {
  cursor: pointer;
}

.select-fancy select {
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box;
  box-sizing: content-box;
  background: transparent;
  border: 0;
  outline: 0;
  text-shadow: 1px 1px rgba(255, 255, 255, 0.7);
  font-size: 14px;
  width: calc(100% - 23px);
  -webkit-user-select: none;
  -moz-user-select: -moz-none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-appearance: none;
  -moz-appearance: radio-container;
  appearance: none;
  float: left;
  padding-left: 5px;
}

.select-fancy:after {
  content: '';
  display: block;
  white-space: nowrap;
  position: absolute;
  width: 0;
  height: 0;
  right: 11px;
  top: 50%;
  margin-top: -4px;
  border-width: 8px 6px;
  border-style: solid;
  pointer-events: none;
  border-color: #656565 transparent transparent transparent;
}

.select-fancy img {
  width: 17px;
  height: 17px;
  float: left;
  margin-top: 1px;
}

@media (max-width: 595px) {
.card-columns {
-webkit-column-count: 1;
        -moz-column-count: 1;
    column-count: 1;
}
}

@media (min-width: 596px) and (max-width: 991px) {
.card-columns {
-webkit-column-count: 2;
        -moz-column-count: 2;
    column-count: 2;
}
}
<section class="card-columns">
  <div class="card card-block">
      <h2 class="card-title"><a href="#">Card Title</a></h2>
      <p class="card-text"></p>
      <fieldset class="clearfix">
        <div class="select-fancy">
          <select class="urlSelect" data-projectid="12">
            <option value="Homepage">Homepage</option>
            <option value="Board Members">Board Members</option>
            <option value="Events">Events</option>
          </select>
        </div>
      </fieldset>
  </div>
  <div class="card card-block">
      <h2 class="card-title"><a href="#">Card Title</a></h2>
      <p class="card-text"></p>
      <fieldset class="clearfix">
        <div class="select-fancy">
          <select class="urlSelect" data-projectid="12">
            <option value="Homepage">Homepage</option>
            <option value="Board Members">Board Members</option>
            <option value="Events">Events</option>
          </select>
        </div>
      </fieldset>
  </div>
  <div class="card card-block">
      <h2 class="card-title"><a href="#">Card Title</a></h2>
      <p class="card-text"></p>
      <fieldset class="clearfix">
        <div class="select-fancy">
          <select class="urlSelect" data-projectid="12">
            <option value="Homepage">Homepage</option>
            <option value="Board Members">Board Members</option>
            <option value="Events">Events</option>
          </select>
        </div>
      </fieldset>
  </div>
</section>

Answer №1

It's interesting how simply removing the overflow:hidden; property can solve the issue. It's a mysterious occurrence that leaves me wondering about the underlying cause.

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

Can the state and city be filled in automatically when the zip code is entered?

I have a form where users can enter their zip code, and based on that input, the corresponding city and state will automatically populate. These three fields are positioned next to each other within the same form. Here is an example of my form: $(' ...

Create collapsible horizontal submenus in Bootstrap for mobile devices

I created a modal specifically for mobile users that displays when they access the site. It features various categories and nested menus for easy navigation. <!-- Modal --> <div class="modal fade" id="exampleModalCenter" t ...

Weird Chrome behaviors with CSS3 animations

I have been working on a CSS3 animation that involves rotating a div with an image in the background. My goal is to have the same animation play at a different speed when the user hovers over the element. Here is the code snippet I have been using: .roc ...

Combining Javascript and Django for a powerful web development solution

Having trouble setting up JS on my Django web app, despite reading through the documentation and previous queries. Using the Django dev server with the following file structure: mysite/ __init__.py MySiteDB manage.py settings.py ...

Utilizing Express for hosting public static resources

I am having trouble configuring my Express server to serve files from the public folder. Despite trying various file path combinations, Pug does not seem to cooperate with Node.js. While I can view the HTML content of the index, the CSS and music files fai ...

The horizontal overflow in the HTML code was unsuccessful

I stumbled upon an interesting issue where I applied a div with specific styling: overflow-x: scroll However, the outcome was not as expected. Instead of overflowing, the content simply started on a new line. Here is the source code for reference: & ...

A slender gap of white space delicately separates the transformed parent from its offspring

When trying to align a parent div with a child div that has the same background-color as the parent's border-color, I am encountering an issue. Despite my efforts, there seems to be a thin line of whitespace separating the two divs. It is worth notin ...

Setting various font sizes for a single element

I'm looking to enhance my text by incorporating an embedded font in addition to Arial as a backup option. However, the embedded font requires a larger font size compared to Arial. Is there a way to ensure that when displaying the same text element, A ...

Focusing solely on the presence of lowercase characters within the text field

Is it possible to apply a different color to lowercase letters in a text area? I am looking to highlight all lowercase letters in red while keeping the uppercase letters black. ...

Is there a workaround for lack of border radius support in IE8 when css3PIE is not functioning

I've come across numerous versions of this question, but none have been successful for me. I'm attempting to achieve rounded corners in IE8 similar to what I see in Firefox and Chrome. Below is my CSS code after integrating css3PIE: border-top- ...

What is the problem with locating elements in Selenium with Java?

I've been encountering difficulties in finding elements on a webpage structured like this: <tr id="filter100" style="...." idx=0 <td> <div onclick=... style=... <table dir = "fil"> <tbody> ...

What is the best way to create a text shadow effect for a heading element?

Is it possible to create a centered heading like the one in this image using only CSS, without using flexbox? [EDIT] Below is an example using flexbox. However, there are some limitations with this code as it doesn't allow reusing the same class for ...

Adjusting jQuery Button Width with input type of "button"

Currently, I am working with jQuery Mobile to develop a straightforward Golf Score Card App. To calculate the total at the end of a form submission, I've implemented the following code. <input id="total" type="text" name="total" value="" readonly= ...

Does vuetify offer a card footer or card deck feature in its designs?

I'm trying to achieve a layout similar to this: https://getbootstrap.com/docs/4.0/components/card/#card-groups https://i.sstatic.net/HxKEh.png The goal is to keep the height of the box consistent even when the description varies Here's my code ...

Show several popovers concurrently by hovering over text utilizing Bootstrap 3's popover feature

Is there a way to display multiple popovers at once when hovering over text, similar to the example provided in this link? I attempted the following method, but it wasn't successful. <div class="row"> <div class="col-md-12"><br/&g ...

Is there a way to automatically scroll to the bottom of a div when it first

Looking to enhance my application with a chat feature that automatically scrolls to the bottom of the chat page to display the latest messages. Utilizing VueJs: <template> <div id="app"> <div class="comments" ...

Revamp the button's visual presentation when it is in an active state

Currently, I'm facing a challenge with altering the visual appearance of a button. Specifically, I want to make it resemble an arrow protruding from it, indicating that it is the active button. The button in question is enclosed within a card componen ...

The slider causing conflicts with widgets and content positioned below it in an HTML layout

When implementing a slider with a fade effect, there seems to be an issue with the placement of widgets on the homepage. The problem arises from the margin-top setting as when images change in the slider, the widgets clash with the slider. During the trans ...

Solving issues with Tailwind CSS class names within Next.js

I'm currently working on a project built with Next.js and styled using Tailwind CSS. Unfortunately, I've run into an issue concerning classNames in my page.js file. I've double-checked my import statements, but the error persists. I'm s ...

JS causes the navigator to malfunction

UPDATE: Greetings! I have developed a navigation bar that loads various pages into a specific div. Here is the source code for the navigation bar: <div id="navBar"> <ul> <li><a href="#" onClick="document.getElementById('bott ...