pseudo-element

pseudo element :before or :after on an image element

ぃ、小莉子 提交于 2019-12-07 03:12:26
As far as I can tell you can't use :before or :after with text content on an image element? Is this correct? Am I missing something? http://jsfiddle.net/rcztz / I know semantically this isn't correct, I'm using because I'm appending the src to the image using js, but if there's no src I'd like to display alternative content (I could use another div, but it would be nice to just use :after or :before) This is correct. You are not able to use pseudo elements on images As lnrbob says, you cannot use pseudo elements on images. However, put a class on the image and use a background image and you'll

Use :first-line pseudo-element as a jQuery selector

好久不见. 提交于 2019-12-06 23:40:56
I know I can use CSS :first-line pseudo-elmenent to target and change style of the first line in any block of text (like in this demo: http://jsfiddle.net/6H8sy/ ). So the first line can be found and targeted. I was wondering if there's any way to actually select that text to reuse. Something like $(':first-line') (which doesn't work as it is). Josh Crozier Since you can't select the pseudo element itself, you could replicate the behavior of :first-line , to determine the text. I wrote a quick JS function, similar to the one @Kevin B suggest s. The function initially determines the height of

Support of :after in IE7

随声附和 提交于 2019-12-06 16:09:17
Long story short, I want to add an absolutely positioned pseudo element after another element, so I simply use the :after pseudo element in my stylesheet. This works like a charm, except in IE7. I should think that :after is supported in IE7, no? The clearfix hack used in Boilerplate works fine, so why not in my example? When I look at the CSS in the style inspector, it does seem to print it out, so it seems to me that it understands it, but I can't see the generated element nonetheless. Am I missing something? .myclass:after { content:""; display:table; width:100px; height:100px; background:

CSS to specify pseudo element :after following input

二次信任 提交于 2019-12-06 15:04:48
I have html code that I cannot change. I cannot use JS for help. So the only option is CSS. example here: http://jsfiddle.net/4gKPL/ HTML : <!-- code for input --> <div class="form-group complete"> <label>label for text input</label> <input type="text"/> <span class="error-message">This is an error message</span> </div> <!-- code for dropdown --> <div class="form-group complete"> <label>label for select input</label> <div class="custom-selectbox custom-selectbox-form"> <select name="sth" required> <option>a</option> <option>b</option> <option>c</option> <option>d</option> </select> <span class

Getting pseudo-element style values

房东的猫 提交于 2019-12-06 12:12:27
Related to this question Changing CSS pseudo-element styles via JavaScript , is there any way using javascript that I can access a pseudo-element's style attributes? Jack It depends on the browser. I don't believe IE supports this in any way, but for FireFox and Webkit browsers, you can use the following: window.getComputedStyle(element, pseudo-selector); For example: window.getComputedStyle(document.body, ':before'); See: getComputedStyle 来源: https://stackoverflow.com/questions/13644399/getting-pseudo-element-style-values

css apply styling to all elements except those in the last row

被刻印的时光 ゝ 提交于 2019-12-06 08:51:48
问题 I have a product category page with 3 products per row. I want every row to have a border bottom except for the last row. This should have no border bottom. The last row may contain 1, 2, or 3 <li> elements. The current code that I'm using applies the border-bottom property to every 3rd <li> element, which is not quite what I want. CSS: .products li { width: 33.33333%; } .products li:nth-child(3n){ border-bottom: 1px rgba(51, 51, 51, 0.1) solid; } .products li:nth-child(2-PREVIOUS-SIBLING

How can I get css pseudo element :checked to work in IE7 + IE8?

烂漫一生 提交于 2019-12-06 05:39:39
问题 I'm trying to style selected radio buttons different than non-selected radio butons in IE 7+8. I've tried selectivizer and it fixed the problem, but also created other problems with css background images being set as hidden. Does anyone know of another JS library that will fix the IE pseudo issue? 回答1: Have you tried IE9.js ? http://code.google.com/p/ie7-js/ http://www.charlescooke.me.uk/web/lab_notes/ie7_script.html http://ie7-js.googlecode.com/svn/test/index.html http://ie7-js.googlecode

Why add block level to pseudo-element?

久未见 提交于 2019-12-06 04:24:28
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. 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 property. Then click 'Add content'. Because .page-wrap has a negative margin-bottom, it will only push the

webkit css pseudo elements for time field

爷,独闯天下 提交于 2019-12-06 02:58:01
问题 I found an interesting post about webkit pseudo elements for inputs here, so I needed to remove cancel button from input type="time", but by murthy's law exactly this pseudo element not described anywhere. If someone knows please post me. P.S. I already tryed ::-webkit-search-cancel-button ::-webkit-input-cancel-button ::-webkit-time-cancel-button ::-webkit-time-cancel-button Of course there is a way to do this with :after element, but I don't believe there are no pseudo element for this

Show :after when hovering over the parent element via CSS

倾然丶 夕夏残阳落幕 提交于 2019-12-05 22:34:17
问题 Is it possible to display:block; the :after pseudo-element when I hover over the parent element itself? #myDiv{ position:relative; width:50px; height:50px; border-style:solid; background-color:red; } #myDiv:after{ position:absolute; content:""; display:none; width:50px; height:50px; border-style:solid; background-color:blue; } I have tired: #myDiv:hover #myDiv:after{ display:block; } #myDiv:hover + #myDiv:after{ display:block; } #myDiv:hover > #myDiv:after{ display:block; } Yet no luck, here