Show pseudo element between elements
Tags: html,css,pseudo-element
Problem :
I've been trying to work out how to show an ::after
pseudo element between each element in a set.
HTML:
<div class="outer">
<div class="element">Hello</div>
<div class="element">World</div>
<div class="element">!</div>
</div>
CSS:
.outer .element:not(.outer > .element:last-child)::after
{
content:"";
display:inline-block;
background:url(images/test.png);
width:4px;
height:5px;
}
My understanding is that my CSS is targeting all elements with a class of element
under an element with a class of outer
that aren't the :last-child
in that set. I guess I'm either wrong, or what I'm trying isn't possible?
Is this possible, and if so, how?
Solution :
You could just use this:
outer .element + .element:before
{
content:"";
display:inline-block;
background:url(images/test.png);
width:4px;
height:5px;
}
It's the adjacent sibling selector syntax.
Edit: swapped after for before pseudo class
Edit 2: demo
CSS Howto..
I think that using flexbox would be the best thing; if you want support for lesser browsers, you could do something like this: #content{background:green;width:100%;} #sidebar-right, #sidebar-left{ background:pink; width:50%;float:left; } @media...
http://jsfiddle.net/dxbbog2k/ img { vertical-align: middle; width: 300px } h2{ display: inline; } p{ clear:both; display: block; } <img id="img" src="http://dreamatico.com/data_images/kitten/kitten-3.jpg"> <h2> Text that should be next to the image. </h2>...
You can use multiple linear-gradient images as background for the parent div container like shown in the below snippet. This is one way to achieve it without adding any extra...
Let's imagine your jdk 8 home bin directory is on your shell path. Create Love.java: import javafx.stage.*; import javafx.application.*; import javafx.scene.control.*; import javafx.scene.*; public class Love extends Application { public...
I'm not sure if you wanted the sub-menu to appear on hover, but it's pretty trivial using straight CSS by adding these 2 classes: .header-nav-menu li > ul { display:...
To set the id: tbl.setAttribute('id', thisTablesId ); But probably what you want is to set the class attribute instead. Those don't need to be unique. You can change the css...
For camera.php, you need to return the data in a format in which your ajax call can read it properly. Assuming that the call to images is returning correctly, you...
Try this... @media (max-width: 1230px) { .navbar-header { float: none; } .navbar-left,.navbar-right { float: none !important; } .navbar-toggle { display: block; } .navbar-collapse { border-top: 1px solid transparent; box-shadow: inset...
Just remove display: inline-block !important; from .list-unstyled li and give display: flex; flex-wrap: wrap; to .list-unstyled will make it as your expected result. .list-unstyled { background-color: #eee; width: 100%; display:...
word-wrap: break-word https://developer.mozilla.org/en/CSS/word-wrap...
Your code looks mostly fine to me. As others have suggested, you're missing <li></li> inside of your <ul>. Also, there is a typo in your CSS: text-aling should be text-align....
Take a array of colors and text contents to dynamically change content and text inside div String colors = ["red","green","blue",....up to 11]; String text = ["Murali","Bobby","Candy"....up to 11]; var x...
Right. This will do it. .whatever-the-class-is { /* No border */ border-style:none; Now for some shadow -webkit-box-shadow: 3px 3px 3px rgba(0,0,0,0.3); box-shadow: 3px 3px 3px rgba(0,0,0,0.3); -moz-box-shadow: 3px 3px 3px...
For chrome you can use Quick Source Viewer to see all CSS, whether in the body or the head, whether in the served HTML or injected at runtime. It is...
For this: <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- frontpagebelowmap --> <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-7211665888260307" data-ad-slot="3839303791"></ins>...
It looks like you are trying to float two columns next to each other. This is fairly simple and covered in depth here : http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/ I tend to stay away...
it can't be done by float, because it's no valid flow. Try this: <style type="text/css"> .A { background: green; } .B { background: yellow; position: relative; } .C { background:...
I placed the decorative images inside the center .box element and straightened them by giving them the opposite rotation to their parent, i.e. rotate:-45deg. The main problem with this approach...
You cant do that, however you can pass in 2 variables, one for the class and another for the color to the mixin.
If are only looking for a transparent background on the rounded box element, use the following code: .rounded_box{ ... background-color:rgba(128,193,255,0.6); ... /*filter:alpha(opacity=60); Remove this */ } .rounded_box h1{ ... }...
Wrap your #Map div in a parent div, and give the parent div the following: #parent { position: relative; margin: 0 auto; width: 256px; } See DEMO....
You can use :nth-child(n) selector to thicker some of your borders : DEMO as for a table , you can use these CSS rules : table { margin:1em auto; }...
you need to add background-size: cover; .bodybackground { background: url('/media/import/background.jpg') no-repeat center center fixed; background-size: cover; } ...
Add display:block; to textarea style. After that textarea will be treated as block element and will be displayed centered. textarea { display:block; resize: none; overflow: hidden; width: 460px; padding: 3px;...
Yep, you can do it like this: <a href="#1" style="height:100px; width:100px;"> <div class="#2"></div> <div class="#3"></div> <div class="#4"></div> <div> <input onclick="doSomething(); return false;" /> </div> </a> ...
I have made small changes like change the document event and add e.stopPropagation(). Please check. $('.subnav__right li a').click(function(e){ e.preventDefault(); e.stopPropagation(); var $this = $(this).parent().find('.subnav__hover'); $('.subnav__hover').not($this).hide(); $this.toggle(); }); $(document).click(function (e) {...
Please refer to this link. I hope it's helpful.
You have something very similar to this already in your JQuery, where you set the nav opacity based on the scroll position: if (scrollDistance >= 0 && scrollDistance < firstFade)...
You can use positioning to move the red list item to the left, and text-align:center on the <ul> to center the blue list item: ul { background-color:yellow; width:100%; height:25px; margin:0px;...
I would give them all the same class, say topitem, and use a rule like this: .topitem:hover p { color:rgba(255,255,255,1); cursor:pointer; } Although really, I would get rid of the...