I'm using a trick to add a border between navigation items
li {
&:not(.active) {
&::before {
border-bottom: grey;
bottom: 0;
content: '';
height: 1px;
left: 20px;
position: absolute;
width: 220px;
:host-context(.minified) {
display: none;
}
}
It works fine. You can see the yellow marked line.
If navigation is active i do not add this border.
If the navigation link is active, i would like to remove the border from previous sibling. You can see the red arrow.
Anybody ideas how can i do that?
You can define the divider at the top of the li and remove the first divider with li:first-child:after
Now, when hovering you can access the next li with + and set the background to be transparent.
Here's an example:
html, body{
padding: 0px;
margin: 0px;
}
ul {
border-right: 2px solid #e5e5e5;
width: 180px;
box-shadow: 5px 2px 10px #e5e5e5;
margin: 0px;
padding: 0px;
}
li {
list-style-type: none;
height: 40px;
display: flex;
align-items: center;
margin: 0px;
padding-left: 15px;
position: relative;
}
li:after{
position: absolute;
background-color: #e5e5e5;
top: 1px;
height: 1px;
width: 130px;
left: 20px;
z-index: 1;
content: "";
}
li:first-child:after{
height: 0px;
}
li:hover {
color: #13A83E;
background-color: #e5e5e5;
}
li:hover + li:after {
background-color: transparent;
}
<ul>
<li>Dashboard</li>
<li>Assets</li>
<li>Devices</li>
<li>More</li>
<li>Options</li>
</ul>
Related
Is it possible to disable all global CSS inside a VueJS component in order to allow only scoped CSS in the component ? If yes, how ?
The problem I'm trying to solve is detailed below.
* {
margin: 0 auto;
padding: 0;
text-align: center;
color: black;
font-family: tahoma;
}
.items ul {
padding-top: 20px;
position: relative;
}
/* Make all children "inline" */
.items li {
/*float: left;*/
display: inline-block;
text-align: center;
list-style-type: none;
position: relative;
padding: 20px 5px 0 5px;
}
/* Add horizontal connector. Note: they are 2 pseudo-elements */
.items li::before, .items li::after {
content: '';
position: absolute;
top: 0;
right: 50%;
width: 55%;
height: 42px;
z-index: -1;
border-top: 1px solid #CCC;
}
.items li::after {
border-left: 1px solid #CCC;
left: 50%;
right: auto;
}
/* Remove left and right connector from a single child */
.items li:only-child::after, .items li:only-child::before {
display: none;
}
.items li:only-child {
padding-top: 0;
}
/* Remove "outer" connector */
.items li:first-child::before, .items li:last-child::after {
border: 0 none;
}
/* Add back the down connector for last node */
.items li:last-child::before {
border-right: 1px solid #CCC;
border-radius: 0 5px 0 0;
}
/* Add curve line to the first child's connector */
.items li:first-child::after {
border-radius: 5px 0 0 0;
}
/* Add down connector from parent */
.items ul ul::before {
content: '';
border-left: 1px solid #CCC;
z-index: -1;
height: 20px;
position: absolute;
top: 0px;
left: 50%;
width: 0;
}
/* Add cosmetic for each item */
.items li a {
font-size: 12px;
background-color: white;
border: 1px solid #CCC;
padding: 5px 10px;
height: 14px;
text-decoration: none;
display: inline-block;
border-radius: 4px;
}
/* Change bg-color while hovering each item */
.items li a:hover {
background-color: #EEF;
}
/* EXPERIMENTAL for multiple parents */
/* Add margin for the parents */
.items li a:not(:only-of-type) {
position: relative;
margin-bottom: 16px;
}
/* Add "down" connector (vertical line) from each multi-parent, EXCEPT the last one */
.items li > a:not(:last-of-type)::after{
content: '';
position: absolute;
border-left: 1px solid #CCC;
border-bottom: 1px solid #CCC;
top: 20px;
width: 75%;
height: 20px;
left: 50%;
z-index: -1;
}
/* Special case for the last multiple-parent, using border-right */
.items li > a:not(:only-of-type):last-of-type::after {
content: '';
position: absolute;
border-right: 1px solid #CCC;
border-bottom: 1px solid #CCC;
top: 20px;
width: 50%;
height: 20px;
right: 50%;
z-index: -1;
border-bottom-right-radius: 5px;
}
/* Give the curve line to the first multiple parent .... */
.items li > a:not(:only-of-type):first-child::after {
border-bottom-left-radius: 5px;
}
/* The middle element of multi-parents*/
.items li > a:not(:first-child):not(:last-of-type)::before {
content: '';
position: absolute;
border-bottom: 1px solid #CCC;
top: 40px;
width: 50%;
right: 50%;
z-index: -1;
}
.items ul:last-of-type li {
padding-left: 0;
padding-right: 0;
}
<div class="items">
<ul>
<li>
Dagon
Veil of Discord
Other Parent Item
<ul>
<li>
Null Talisman
<ul>
<li>Circlet</li>
<li>Mantle of Intelligence</li>
<li>Recipe: Null Talisman</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
This code comes from https://jsfiddle.net/sangprabo/o8dda3um/23/
But I get some css perturbation coming from Laravel global CSS, like shown in the image below, this is why I'd like to disable any CSS causing these perturbation.
I finally fixed it by adding this in my component's CSS:
<style lang="css" scoped>
*, *::before, *::after {
box-sizing: content-box;
}
...
</style>
I'm trying to implement the following on my website:
Obviously this should be able to go on for more iterations, I don't really know what to google for, I found a way to create a line, but I have no idea how to combine that with Circles and how to make those aligned with the text.
Final code:
* {
box-sizing: border-box;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
ul li div {
width: 50%;
float: left;
text-align: center;
}
ul li .zero-left {
position: relative;
color: #EB908B;
width: 30%;
text-align: right;
padding-right: 20px;
}
ul li .zero-right {
border-left: 3px solid #3C4C4C;
position: relative;
color: #3C4C4C;
width: 70%;
padding-left: 15px;
text-align: left;
}
ul li .first {
position: relative;
color: #EB908B;
width: 30%;
text-align: right;
padding-right: 20px;
}
ul li .second {
border-left: 3px solid #3C4C4C;
position: relative;
width: 70%;
padding-left: 15px;
text-align: left;
}
ul li .second p {
color: #EB908B;
position: relative;
text-align: left;
}
ul li .first::before {
content: '';
position: absolute;
right: -11.5px;
width: 20px;
height: 20px;
border-radius: 150%;
border: 2px solid #3C4C4C;
background: #3C4C4C;
z-index:9999
}
You can use after pseudo-element to put circle. Here I made an example with after solution.
jsfiddle
I want to add an icon (a small triangle) under a link using the CSS :after attribute, It works in Chrome but not in Firefox and IE. Here is the result in chrome:
but in IE and firefox here is the result:
The CSS code:
li.ui-state-active > a:after {
width: 22px;
height: 19px;
position: absolute;
display:block !important;
left: 50%;
margin-left: -11px;
bottom: -19px;
z-index: 2;
content: '';
**background-image: url(#{resource['img:css/arrow-menu-onglet.png']}) no-repeat !important;**
}
also I tried this but with the same result (ok in just chrome):
li.ui-state-active > a:after {
width: 22px;
height: 19px;
position: absolute;
display:block !important;
left: 50%;
margin-left: -11px;
bottom: -19px;
z-index: 2;
**content: url(#{resource['img:css/arrow-menu-onglet.png']}) no-repeat !important;**
}
Can you help me please figure out why?
No image needed:
/* tabbed nav */
nav ul {
list-style: none;
}
nav li {
display: inline-block;
}
nav li a {
position: relative;
display: inline-block;
padding: 15px 25px;
background: #fff;
margin-right: 4px;
margin-bottom: 7px;
}
nav li a.state-active:after,
nav li a.state-active:before {
content: " ";
position: absolute;
z-index: 1;
left: 0;
right: 0;
margin: 0 auto;
width: 0;
}
nav li a.state-active:after {
bottom: -15px;
border-top: 15px solid #fff;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
}
nav li a.state-active:before {
bottom: -23px;
border-top: 23px solid #DBD5C7;
border-left: 23px solid transparent;
border-right: 23px solid transparent;
}
/* ----- */
* {
margin: 0;
padding: 0;
}
body {
margin: 20px;
background: #DBD5C7;
}
div {
background: #fff;
height: 100px;
}
<nav>
<ul>
<li>LINK 1
</li>
<li>LINK 2
</li>
<li>LINK 3
</li>
</ul>
</nav>
<div></div>
I have a sidebar on the page that should look like this
but What I get is this
The submenu doesn't show as it should, my code look like this
.submenu{
position: absolute;
}
.submenu ul{
height: auto !important;
background-color: transparent !important;
}
.submenu ul li{
position: static !important;
}
When I assign right: value the behavior of the component is not usual. Here is a jsfiddle
Thank you!
Okay I got this to work but not in the fiddle you provided. When making a fiddle for a question on overflow try to isolate only the code that pertains to the question or problem. When you add everything in there it makes it a little hard to find the related material.
I made a fiddle for you to show how it works and if you like how it is then feel free to just use that. This is a css dropdown and doesn't require any scripting. What you need to do is nestle a ul inside of the main ul's li tag. You then have to hide the nested ul to later be revealed on a hover action.
The triangle I made does not have to be a CSS3 triangle, you can use an image.
HTML
<div class="sideBar">
<ul>
<li>¿Porqué Nosotros?</li>
<li><span class="tri"></span>Pregrado
<ul>
<li>Diseño & Comunicación Visual</li>
<li>Comunicació y Relaciones Públicas</li>
</ul>
</li>
<li>Posgrado</li>
<li>Maestría</li>
<li>Calendario</li>
</ul>
CSS
.sideBar {
position: absolute;
top: 0;
left: 0;
background: black;
color: #fff;
width: 200px;
}
.sideBar ul {
list-style-type: none;
padding: 0;
margin: 0;
}
.sideBar ul li {
height: 20%;
width: 180px;
padding: 10px 0 10px 20px;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
}
.tri {
content: "";
border-top: 19px solid transparent;
border-bottom: 19px solid transparent;
border-left: 10px solid red;
position: absolute;
width: 0;
height: 0;
padding: 0;
margin: 0;
left: 100%;
top: 20%;
display: none;
z-index: 1000;
}
.tri:after {
height: 38px;
left: 100%;
top: 0;
content: "";
position: absolute;
width: 10px;
display: block;
}
.sideBar ul li:hover .tri {
display: block;
}
.sideBar ul li:hover {
background: red;
}
.sideBar ul li ul {
display: none;
position: absolute;
top: 30%;
left: 100%;
}
.sideBar ul li ul li {
background: #7b7b7b;
border: none;
padding-left: 20px;
width: 260px;
}
.sideBar ul li ul li:hover {
background: black;
}
.sideBar ul li:hover ul {
display: block;
}
Here is a fiddle you can use for a visual reference.
jsfiddle
If you need more help then let me know.
I've created a custom breadcrumb in jsfiddle http://jsfiddle.net/jimbodeni/Ata9k/ . When you shrink the width of the page the text is on 2 lines on the last 2 breadcrumbs but is only on one line on the first breadcrumb. This causes the grey background to be out of line on the first breadcrumb with the other 2.
How can I get this to always be the max height of the largest breadcrumb so they're all uniform height no matter if one has got one line of text and another 2 lines of text?
<div id="breadcrumb-container">
<ul class="breadcrumb">
<li>Surgery Started</li>
<li class="current">Surgery Started</li>
<li>Surgery Compl'd</li>
</ul>
</div>
div#breadcrumb-container {
width:100%;
}
div#breadcrumb-container li {
width: 33%;
}
div#breadcrumb-container li:last-child {
width: 34%;
}
.breadcrumb {
list-style: none;
overflow: hidden;
font: 13px Helvetica, Arial, Sans-Serif;
}
.breadcrumb li {
float: left;
background: #C7C7C7;
}
.breadcrumb li a {
color: white;
text-decoration: none;
padding: 5px 5px 5px 45px;
position: relative;
display: block;
}
.breadcrumb li a:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid #C7C7C7;
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.breadcrumb li a:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid #001940;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 3px;
left: 100%;
}
.breadcrumb li:first-child a {
padding-left: 12px;
border:none;
}
.breadcrumb li:last-child a:after {
border:none;
}
.breadcrumb .current {
background:#007ACC; color:#fff;
pointer-events: none;
cursor: default;
}
.breadcrumb .current a:after {
border-left-color:#007ACC;
pointer-events: none;
cursor: default;
}
.breadcrumb li a:hover { background: #007ACC; }
.breadcrumb li a:hover:after { border-left-color: #007ACC !important; }
Also, how do I get all 3 breadcrumbs to be exactly the same size? At the minute the first one is bigger than the other 2.
Thanks in advance to anyone who can help!