pseudo-class

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

Why CSS :not pseudo-class doesn't work as expected?

心已入冬 提交于 2019-12-05 22:54:05
Consider the following HTML: <div class="a"> <div class="b">Hello</div> </div> <div class="c"> <div class="b">World</div> </div> Adding the following CSS colors only "World" in red, as expected: .c .b { color: red; } But, adding the following CSS instead colors both "Hello" and "World" in red : :not(.a) .b { color: red; } Why? You need to give it like this:- Demo div:not(.a) .b { color: red; } Pseudo-class :not Syntax is selector:not(){ properties } Since the :not pseudo-class represents an element that is not represented by its argument, you have to specify the element you want to exclude

Is :hover:after supported in IE8?

心已入冬 提交于 2019-12-05 19:46:28
I have a flyout menu where at the end of "Quick Links" I use the :after pseudo-element on the first LI tag to display an icon from a sprite file. The HTML: <ul class="rs-quick-links-nav"> <li> <a href="#">QUICK LINKS</a> <ul> <li><a href="#">Enhanced Recipe Search</a></li> <li><a href="#">Recipe Collections & Favorites</a></li> <li><a href="#">Cooking Tips & Techniques</a></li> <li><a href="#">Shopping & Storing</a></li> <li><a href="#">Tools & Products</a></li> <li><a href="#">New Uses for Old Things</a></li> <li><a href="#">Guide to Ingredients</a></li> </ul> </li> </ul> The CSS: .rs-quick

What's the best practice(s) to place an icon before or after links to indicate file type (ex: linking Adobe PDF, audio or video)

不想你离开。 提交于 2019-12-05 12:44:14
My team was debating what the best practice would be for wanting to insert an icon after links to the various media file types we have on our site. Examples would be linking to a PDF and wanting to insert an icon image to let users know it's a PDF. The same could be used for video or audio files. I suggested using CSS, putting a class on the and using :after to create an element. I recall IE6 and IE7 won't support the pseudo CSS class, but aside from that, would there be a better practice? If the links were in an unordered list, I know the icon image could be used to replace a bullet character

css last-child not working when adding divs of different classes

删除回忆录丶 提交于 2019-12-05 12:36:28
I have some HTML that looks like this: <div class="SomeContainer"> <div class="MyClass"></div> <div class="MyClass"></div> <div class="MyClass"></div> <div class="MyOtherClass"></div> </div> And I use the following CSS .MyClass{...} .MyClass:last-child{box-shadow:0px 5px 10px black;} I wrongly assumed that last-child operated on the last child of a certain class but it actually operates on the last-child of the container if it's of the same class. Is there some convenient way around? I know I could add a wrapper around the MyClass div and add the CSS for the shadow to the wrapper but I was

Is there a css pseudo selector for overflow?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 11:59:32
问题 I'm trying to alter the style of something based on wether or not its parent div is being overflown. .pDiv { display: block; width: 300px; height: 100px; border: 1px solid rgb(0,0,0); } .cDiv { display: block; padding 4px; border-bottom: 1px solid rgb(0,0,0); .pDiv:overflow .cDiv { border-bottom: none; } <div class="pDiv"><div class="cDiv">child 1</div><div class="cDiv">child 2</div><div class="cDiv">child 3</div><div class="cDiv">child 4</div><div class="cDiv">child 5</div></div> is it

why “a:hover MUST come after a:link and a:visited(w3school)”? [duplicate]

。_饼干妹妹 提交于 2019-12-05 10:34:08
This question already has answers here : Why does .foo a:link, .foo a:visited {} selector override a:hover, a:active {} selector in CSS? (3 answers) Closed 3 years ago . I‘m study CSS in the "w3schools", in the chapter of "link", they say: "When setting the style for several link states, there are some order rules: a:hover MUST come after a:link and a:visited a:active MUST come after a:hover" I want to know why the correct order is L.V.H.A, not L.H.V.A or another. Pseudo-classes must be declared in a specific order. The mnemonic L o V e HA te is always useful for remembering the correct order:

Is there a CSS “:drop-hover” pseudo-class?

拟墨画扇 提交于 2019-12-05 09:12:26
问题 Saying I have an input type="file" field. One can drop a file on this input (like in Firefox) instead of clicking "browse" and selecting the file. Now, I want to customize it a bit, by changing the field's background color when one is about to drop a file in the input . I cannot really use :hover since it matches even when you're not drag&dropping. Is there a CSS (pseudo-class) to do that? And is there a CSS way to style different if the file being dropped is not accepted and if it is? Say,

css pseudoclass:hover not working

左心房为你撑大大i 提交于 2019-12-05 08:43:28
I am struggling to get a simplest css hover pseudoclass to work. Anybody knows why the following doesnt work? the css #hidden {display:none;} #show:hover #hidden{display:block;} the html <a href="#" id="show">show</a> <div id="hidden">here i am</div> I really feel stupid asking such a simple question, i did this a hunderd times, but cant figure out why this shouldnt work. Try this #show:hover + #hidden{display:block;} :hover #hidden implies that #hidden is a child of the hover element. The + selector looks for the next adjacent sibling. 来源: https://stackoverflow.com/questions/3847568/css

CSS: a:link vs just a (without the :link part)

你离开我真会死。 提交于 2019-12-05 01:25:31
So we're required to use the following order for CSS anchor pseudo-classes a:link { color: red } a:visited { color: blue } a:hover { color: yellow } a:active { color: lime } But my question is why bother with the a:link part? Rather, is there any advantage to the above (other than perhaps clarity) over: a { color:red; } /* notice no :link part */ a:visited { color: blue; } etc.,etc. :link selects unvisited links, that is: anchors with an href attribute which have not been visited by the browser (for whatever definition the browser vendor has for "visited"). If it has :link then it will never