pseudo-element

Font Awesome 5 on pseudo elements shows square instead of icon

淺唱寂寞╮ 提交于 2019-12-16 19:50:21
问题 I am trying to change the content of a span with a Font Awesome icon directly from the CSS page but can't seem to make it work properly. 1) I have imported FA from the documentation and in the <head> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous"> 2) My html looks like this : <span class='myClass'>Movies</span> 3) Let's now say I would like to

:first-letter on li elements

风格不统一 提交于 2019-12-13 16:19:50
问题 I'm trying to use a :first-letter pseudo element on a navigation menu. HTML such as: <nav> <ul> <li>Navigation</li> <li>Navigation</li> <li>Navigation</li> <li>Navigation</li> </ul> </nav> And CSS like: nav li:first-letter {font-size: 150%;} I've also tried nav ul li:first-letter {font-size: 150%;} to no help. I can see it working for the first element on the <ul> tag if I adjust it to this: nav ul:first-letter {font-size: 150%;} but still can't get exactly what I need; <li> 's inline whose

Animating css's after and before selectors in jQuery

落爺英雄遲暮 提交于 2019-12-13 16:07:38
问题 Is it possible to animate CSS's selectors :before and :after in jQuery's .animate() function? If not, what is the best alternative to doing that? 回答1: In short no - jQuery does not support pseudo element animations or even selectors I believe. You can however animate pseudo elements using css3 transitions but it is to note that only Firefox 4.0+ supports it currently, so your playing field is very limited. If it's that important, just create new child elements in the element you want to

Toggle a pseudo-element using jQuery

微笑、不失礼 提交于 2019-12-13 12:21:58
问题 I am trying to toggle the display of an :after pseudo-element (ie.to show/hide it) using jQuery. I successfully toggled the display of a div, but want to do this now with :after . The :after is being used to create the arrow on the box. My attempt can be seen here: http://jsfiddle.net/beechboy707/7um9knxt/1/ Here is an extract from it showing the jQuery which is supposed to relate to the CSS selector: $("#supportus-button-1").click(function () { $(".supportus-button:after").toggle(); }); 回答1:

Getting H1 text to wrap beside a ::before pseudo element

冷暖自知 提交于 2019-12-13 04:48:13
问题 I have a fairly long H1 title containing a link with a pseudo ::before element that I want to wrap to two lines correctly. Here's what I need: A pseudo ::before element on an a link inside of an H1 (it needs to be clickable, so can't be on the H1). I have this done successfully. The text to wrap normally and align with the left side of the first word. This is where the problem is. See my testing codepen here: http://codepen.io/dmoz/pen/EaZqKv Seems like it should be a simple fix, but I can't

How can I use the CSS pseudo-element :before{ content: '' } to affect an <option> element?

六眼飞鱼酱① 提交于 2019-12-13 03:59:25
问题 If I have a list of optons, how can I use the CSS pseudo-element :before{ content: '' } to affect the <option> ? Below there are three options an I'd like to insert text before each one. I know this can be done wit javascript / jQuery, but is it possible with CSS? <html> <head> <style> option::before { content: "sandy - " } </style> </head> <body> <select> <option>beach</option> <option>field</option> <option>carpet</option> </select> </body> </html> 回答1: The ::before and ::after pseudo

Internet Explorer isn't treating non-empty ::before and ::after as children elements

左心房为你撑大大i 提交于 2019-12-13 02:27:25
问题 My span has visibility: hidden; applied to it, and it has non-empty ::before and ::after pseudo-elements that aren't respecting the visibility: visible; property in Internet Explorer (all versions) as they should be. What's causing this to happen? span { display: block; height: 8px; width: 50px; background: black; position: absolute; top: 24px; visibility: hidden; } span::before, span::after { content:"asdf"; position: absolute; display: block; left: 0; width: 50px; height: 8px; background:

right-align CSS before: numbers?

断了今生、忘了曾经 提交于 2019-12-12 13:16:07
问题 I want to have numbered paragraphs without resorting to using ordered lists. I'm trying to accomplish this by using content:counter(paragraph) in CSS so that every paragraph block I create generates a number to the left of it. .pass { counter-reset:paragraph; } .pass p:before { content:counter(paragraph); position:absolute; font-size:0.6em; color:#999; margin-left:-3em; counter-increment: paragraph; } It works fine, but the problem is I can't figure out how to align the numbers so that they

Using before and after pseudo-elements on background image

ε祈祈猫儿з 提交于 2019-12-12 12:25:30
问题 I am wanting to construct navigation items from three (background) images, with the first and last a fixed width, and the central a variable width, depending on the width of the text in the nav item. I have been led to believe that using the pseudo elements before and after would be the best method. When I try this though, the main (central) background image for the nav item is overlapping with the before and after background images. You can see what I mean on this page. Here is the CSS: .box

Why add block level to pseudo-element?

守給你的承諾、 提交于 2019-12-12 10:01:01
问题 From code on this page: http://css-tricks.com/snippets/css/sticky-footer/ .page-wrap { min-height: 100%; /* equal to footer height */ margin-bottom: -142px; } .page-wrap:after { content: ""; display: block; } Can anyone explain what the .page-wrap:after block is doing? I understand the after pseudo-element but I don't understand what is happening here. 回答1: Check out when you edit the Codepen demo and remove either .page-wrap:after from the line which sets its height or its display: block