data-icon not displaying correctly in Firefox and Chrome browsers

Can anyone explain why this code works in Safari, but not in Firefox and Chrome?

Here is the HTML:

<input type="search" placeholder="Search" id="search" name="search" id="s" data-icon="s">

And here is the CSS:

#search[data-icon]:before {
    font-family: 'Pictos Custom';
    content: attr(data-icon);
    -webkit-font-smoothing: antialiased;
}

Would really appreciate any assistance.

Answer №1

Remember, you are unable to utilize pseudo-elements on replaced elements, such as <img>, <select>, <input>, <object>, and others that lack content

Check out the Visual Formatting Model in the 2.1 Spec for additional information

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 text that follows the cursor seems to stand out taller than the rest

When I type words in a textarea input field, the cursor seems to be taller than it should be (as shown below). What is causing this issue and is there a way to make it as tall as the words with a font size of 38px? Here is the code snippet: <textarea n ...

Scrolling horizontally using jQuery and CSS

I have been experimenting with creating a horizontal scrolling page that moves to the right when scrolling down and to the left when scrolling up. Here is the current code: HTML <div class="scroll-sections"> <section id=&quo ...

What is the best way to ensure that an image perfectly fits within a div container?

My goal is to make my image occupy half of the div's width and 100% of the height. However, I am facing an issue with a lingering white bar at the bottom. Can you offer some guidance on how to resolve this? Take a look at the site preview .contain ...

Display the value of a shortened string

My Goal I aim to develop a method for determining the amount of a string visible before it gets cut off. Motivation In my project, there is a collection of items that can be chosen. A panel presents a concatenated string of the selected item names separa ...

Using Jquery to determine if a div is empty, excluding any content before or after it

I'm looking to use JQuery to determine if a Div is empty without taking into account any content added before or after it. When checking for emptiness, I want to ignore anything placed before or after the div. $(function(){ if($('#content&ap ...

Creating a Piechart in Kendo UI that is bound to hierarchal remote data

I am facing an issue with binding remote data to a pie chart while managing a grid with dropdown sorting options. The grid is working fine, but I am unable to display the hierarchical data on the pie chart as categories. <!DOCTYPE html> <html> ...

Using an external font in JavaFX CSS

Can you style a font with CSS in a JavaFX application? I have an FXML scene and corresponding CSS file. In Java code, you can set a font using the setFont method: text.setFont(Font.loadFont("file:resources/fonts/SourceSansPro-Bold.ttf", 12)); I've t ...

Double tap on the YouTube video

Recently, I added a YouTube video to my project. However, I am encountering an issue where when I double click on the video, it opens in a new tab. What I actually want is for the video to open in full screen when clicked. Appreciate any help! ...

JS if clause fails to return true as expected

Here is my setup: <div id="user_input">...</div> And a button: <input type="button" id="panel_button">...</button> Using a selector: function $(id) { return document.querySelector(id); } With an event handler: var button_ ...

Expand the initial expansion panel within an Angular Material accordion by opening the first attachment

In Angular Material expansion panels, the expanded input can be used to automatically open a specific panel when the page loads. However, in my dynamic accordion where all panels are optional, I want the first panel to be opened by default. I could manual ...

Achieve full height of parent with rotated text

Hey, I've been experimenting with some CSS transforms and I'm having trouble getting this to work properly. Check it out here I'm using Bootstrap 4 to create two columns; an image on the left and text on the right. I want the text to be ce ...

Tips for expanding an md-nav-item in Angular Material

Need help on stretching the md-nav-item element illustration 1 ------------------------------------------------ | ITEM1 | ITEM 2 | ------------------------------------------------ illustration 2 ------------------------------------------------ | ...

No DIV elements are permitted within the tab content

I implemented a simple jQuery tab code that I found online to display dynamic content: This is the code snippet that I inserted into the HEAD section of my HTML page: <script src="js/jquery-1-9-1.js"></script> <script type="text/javascri ...

Tips on moving down the `<li><span>` elements with the jQuery `.slidedown()` method

I'm struggling to articulate my question clearly, so please bear with me. Essentially, I have a jquery script that reveals content within a div nested in an li. When I click on the header, the content drops down and visually pushes the next header do ...

Switching Font Family Option for Selection Mat in Angular Material

I'm currently working on changing the font of the options inside mat-select ("In what city were you born", etc). After some experimentation, I found that by setting ViewEncapsulation to none (allowing styles from other files to bleed in), I am able t ...

Why is the format incorrect when the Angular 7 (Change)-Function on Input of type Date isn't functioning?

I am facing an issue with updating the date using key input and assigning the selected date to a property of my object. Below is the code I'm currently working with: <input type="date" [value]="dateTime()" (change)="setDate($event)"/> The dat ...

Converting Flex Text into HTML format for seamless integration

In my application, I have the capability to configure certain pages using the RichTextEditor and then save the resulting HTML Text Flow to a database for future use... When I import the saved data into Flex using a RichEditableText, everything appears as ...

Using JavaScript to change text contained within an HTML element into a separate HTML element

Can JavaScript or JQuery make this transformation possible, or is there another method to achieve it? If we have an HTML file structured like this <div> <p>Hello World</p> </div> And the goal is to convert "World" into a stan ...

Establish the Image Aspect Ratio within an Unordered List

I'm having some trouble adjusting the aspect ratio of an image within a ul. Currently, the image is displaying too large in terms of height and I've tried various solutions, such as wrapping it in another div and applying padding-top: 56.25%; to ...

How can I retrieve dt/dd elements and store them in an array using Simple HTML DOM?

Similar Question: Retrieving data from HTML table using preg_match_all in PHP This is the HTML code snippet: <div class="table"> <dl> <dt>ID:</dt> <dd>632991</dd> <d ...