Is there an issue with Webkit browsers not supporting attribute selectors and pseudo elements?

Similar Issue:
Combine CSS Attribute and Pseudo-Element Selectors?

http://jsfiddle.net/BC3Td/

In my testing, I found that in Firefox and Opera everything works fine, but Chrome, Safari, and Mobile Safari are ignoring the second pseudo element css rule and defaulting to the first. Can someone explain why this is happening?

Is there a way to achieve the desired result without adding classes or ids to the elements?

SOLUTION:

It turns out that this issue is related to a bug in Webkit browsers. The fix is quite simple - just add any CSS rule involving only the non-pseudo element, like this:

#test-div a[href*="tel"],
#test-div a[href*="mail"] { display:block; }

Isn't it odd how this workaround fixes the problem?

Here's the updated (working) fiddle: http://jsfiddle.net/BC3Td/3/

Answer №1

Seems to be a glitch in Webkit selection. The pseudo selector works when the element is selected directly as well (an effective no-op used here):

http://jsfiddle.net/BC3Td/2/

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

What are some strategies for effectively utilizing GitHub's primer and octicons?

Utilizing GitHub's primer and octicons. Upon installation with npm, I incorporated the css classes provided by GitHub through the inclusion of the build.css file in my HTML document. How can I direct the project to access all the SVG icons offered by ...

Prevent scrolling in a full-screen modal using CSS

I came across a beautiful fullscreen modal that is purely based on CSS. The only issue I encountered was that the modal isn't scrollable. I attempted various solutions but haven't been successful. Here's the script I am using: ...

Investigating the Hierarchy of CSS Selectors

I've been pondering this question: What exactly is the functional distinction between these two code snippets, if any? I'm not certain how the use of a comma impacts statements. Does the #page > have an influence on the link in the first examp ...

Locating an individual element using Selenide (Selenium) and the cssSelector method

If you have a structure of elements similar to the one shown in the image, it is possible to extract each static property using: $$('#static-information .value').get(0) or $$('.static-property .value').get(0) However, as each static p ...

Issues with the loading of CSS in Wordpress

I transferred the project from the server to my personal computer (localhost). However, whenever I make changes to the css file, these modifications do not appear on the website when viewed locally. After attempting to switch browsers and clear the browse ...

Maintaining consistent div height in Bootstrap 4 flexbox design

I'm currently using Bootstrap 4 with flexbox enabled, but I'm having trouble making the row > col > div boxes have equal heights. I attempted to use position: absolute, but it's not the ideal solution. Below is a screenshot of the is ...

Ensure that the image within the child div occupies the entire height of the parent div

I'm having a bit of trouble figuring this out and could use some input: There's a parent div with an unspecified height, determined by its content. Inside this parent div are two 'child' elements; however, I want only one to dictate t ...

Tips for creating a script that compiles all SCSS files into CSS within a Vue 3 project

Within my project, there exists a file named index.scss located in the src/assets/styles directory. Adjacent to this file are multiple folders housing SCSS files that are ultimately imported into index.scss. My objective is to devise a script within the pa ...

Tips for adding a border to a 3D pie chart in Highcharts

I created a 3D pie chart using the Highchart plugin and wanted to add borders to each portion. I tried adding the following code: borderWidth: 4, borderColor: "red" within the plotOptions: pie: section. However, I noticed that the portions were getting b ...

Empty space encompassing the entire sheet

While developing my website, everything seemed normal until I added a CSS document to my HTML page. Now, when we open the website , there is a white space around the entire page. I attempted to set the body class to container-fluid since I am using Bootst ...

Scrolling within ion-content is fluid when using a fixed div in Ionic

Following the recent GoogleChrome update, a div set to 'fixed' is now scrolling with the rest of the page. For a demonstration, you can visit the following link: LINK Specifically, the issue occurs with a 'fixed' div placed inside the ...

Display of Navigation Bar in Angular is Not Proper

Currently diving into the world of Angular, I've encountered an issue with a material menu that isn't displaying correctly. The expected outcome based on my code should resemble this image: https://i.stack.imgur.com/z70Aq.png This snippet showc ...

flexbox with a table that can be scrolled vertically

I am currently working on creating a scrollable tbody within a flexbox layout. I have two flexboxes, each containing a table. When the items in the table overflow, I want to display a vertical scrollbar within the tbody. However, the tables are within f ...

Ways to design a vertical tab using CSS and JavaScript

I am currently working on creating a Vertical tab element using CSS and jQuery. However, I am facing an issue where I need to display the content of the first tab upon page load. I have tried using the following line of code but it does not seem to be work ...

Ways to update CSS using alternate classes without relying on !important

I have a generic form in my code that styles all my buttons uniformly: input[type="button"],put[type="button"]:active,input[type="button"]:hover { width: 172px; height: 37px; line-height: 2 !important; margin: 11px 0px 0px 0px; padding ...

Centering Images Using CSS Floats

I've got this HTML code featuring images and titles: <div class="container"> <div class="box"><a href="#" class="catname"><img src="image1.jpg" class="thumb"><p>Title 1</p></a></div> <div class="box" ...

Having trouble getting the navigation bar to appear in the upper right corner of the website

Currently, I am working on The Odin Project and trying to create a landing page. I have encountered an issue where my navbar is positioned on the left side when I want it to be on the right side. Here is the code I am using: .container{ width:100%; height: ...

Can someone please provide guidance on how to focus on these boxes? (see image below)

My goal is to specifically target the boxes with white dots inside them. Each black box in this picture represents a blog post, even including the larger one at the top. I initially considered using the nth-child selector, but I'm not confident in how ...

Tips for adjusting the Bootstrap grid layout for mobile viewing

As a beginner in web design and utilizing bootstrap, I am creating a website with two columns of size 6 each within a row. || Col-1 || Col-1 || [Web View] ||||||||||| || Col-1 || ||||||||||| || Col-2 || ||||||||||| [Mobile View] However, I would like th ...

Element misbehaving after a certain point

I'm encountering an issue with a piece of code that is not working as expected. The problem seems to be specifically with the after element. The desired behavior is for two lines to draw from the top left corner and the bottom right corner when hoveri ...