I don't know if I named the title right or have the right terminology but I'm using LESS.
What I want is to apply arrows on some <ul>s while the default is no style. So anytime I want arrows, I want to somehow explicitly say so in code.
I tried adding a pseudo class called .arrow:
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
li {
.arrow{
content: "";
border-color: transparent #111;
border-style: solid;
border-width: 0.35em 0 0.35em 0.45em;
display: block;
height: 0;
width: 0;
left: -1em;
top: 0.9em;
position: relative;
}
}
Then tried to apply it like this:
<ul className="arrow">
<li><span className="ink-badge black small">Consulting</span></li>
</ul>
but no luck. I'm not doing this right; any ideas here?
className is the IDL attribute. In HTML you should use the content attribute, which is called class.
And .arrow is a class selector, not a pseudo-class.
And in selectors, place ancestors at the left (outer block in LESS).
body {
margin-left: 2em;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
.arrow > li {
content: "";
border-color: transparent #111;
border-style: solid;
border-width: 0.35em 0 0.35em 0.45em;
display: block;
height: 0;
width: 0;
left: -1em;
top: 0.9em;
position: relative;
}
<ul class="arrow">
<li><span class="ink-badge black small">Consulting</span></li>
</ul>
Related
I want to make a tab style so the bottom of the tab doesn't have an underline. To do this I thought I could set bottom border color of tab and then make child menu go underneath.
I am not sure if that is possible though.
This excerpt is taken from site, it is done like this as the child menu is usually shown on hover.
body {
background-color: #000;
}
.desktop-menu {
color: #fff;
list-style: none;
}
.desktop-menu a {
color: #fff;
text-decoration: none;
}
.desktop-menu > li {
background-color: blue;
width: 60px;
margin-left: 25px;
border: 1px solid #fff;
border-bottom-color: blue;
padding: 10px;
position: relative;
z-index: 20;
}
.desktop-menu ul {
background-color: blue;
z-index: 10;
width: 200px;
display: flex;
position: absolute;
top: 100%;
left: -1px;
flex-direction: column;
list-style: none;
margin: 0;
padding: 10px 20px;
padding-top: 15px;
border: 1px solid #fff;
background-color: darkblue li;
padding-bottom: 15px;
}
.desktop-menu .has-sub:hover {
border: 1px solid #fff;
}
.desktop-menu .has-sub:hover ul {
display: flex;
}
<ul class="desktop-menu">
<li class="has-sub">Products
<ul>
<li>Product name 1</li>
<li>Prod name 2</li>
</ul>
</li>
</ul>
I am trying to remove this white line:
What is best method to achieve this?
Just a hack but it works.
.desktop-menu > li {
position: relative;
// ...
}
.desktop-menu > li::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 1px;
width: 100%;
background-color: blue;
}
.desktop-menu ul {
display: none;
transform: translateY(-1px);
// ...
}
.desktop-menu .has-sub:hover ul {
display: flex;
}
See result in codesandbox.
Note: not suitable if you are working with transparent backgrounds.
Edit: updated the sandbox to proof it works with the hover effect.
I can't figure out how to change the icon on the li in this url.
I tried to change the content but that just gave an extra figure over the green v.
https://codepen.io/gnevin/pen/axNVex
.check-list {
margin: 0;
padding-left: 1.2rem;
}
.check-list li {
position: relative;
list-style-type: none;
padding-left: 2.5rem;
margin-bottom: 0.5rem;
}
.check-list li:before {
content: ' ';
display: block;
position: absolute;
left: 0;
top: -2px;
width: 5px;
height: 11px;
border-width: 0 2px 2px 0;
border-style: solid;
border-color: #00a8a8;
transform-origin: bottom left;
transform: rotate(45deg);
}
Here use border and transform used for rotation. If you want to change there are a few more ways. First of all, remove the border and put what you want in the content.And use List style for default styling
k.imgur.com/gwikL.png
I've worked around a tooltip that appears in the same line where the link is located and it seems working well, best sying halfway. This tooltip is being used in a list, so it's in the same li where the link appears. The problem occurs in the next li, where the line-height seems to have been lost.
If someone could help me with this, here is the page I'm working in:
https:www.fredericopeter.com.br/playground
The damage is easily visible at the sidebar on the right side of the page.
The html code:
<ul style="margin: 2px 0 10px 20px;">
<li>Portfolio</li>
<li>Blog</li>
<li>Música</li>
<li>Video</li>
<li class="actual sidebar-tooltip">Playground<span class="txt">◄ Você está aqui</span></li>
<li style="clear: right;">Startpage [ ? ]</li>
</ul>
The css code (tooltip):
a.sidebar-tooltip:hover {
text-decoration: none;
}
a.sidebar-tooltip span {
z-index: 10;
display: none;
padding: 0;
margin-top: 0;
margin-left: 0px;
width: 100%;
text-align: right;
color: #3cbfc7;
background: transparent;
}
a.sidebar-tooltip:hover span {
display: inline;
position: absolute;
border: 0;
background: transparent;
}
.sidebar-tooltip {
width: 109px;
height: 10px;
display: inline-block;
position: relative;
border: 0;
background: transparent;
}
.sidebar-tooltip:hover .txt {
display: inline-block;
}
.sidebar-tooltip .txt {
margin-left: 3px;
color: #0a0;
width: 100%;
padding: 0;
display: none;
position: absolute;
z-index: 1000;
background: transparent;
}
.sidebar-tooltip .txt:before {
width: 0;
padding: 0;
position: absolute;
content: '';
}
You can check .sidebar-tooltip class and remove the height. I saw height is set 10px.
I've been trying for a long time to create a cross-browser compatible breadcrumb navigation that works in >= IE8 as well as all newer browsers.
Here is the closest I've come: http://codepen.io/anon/pen/jlbck
(The above link doesn't work in IE8, but you can see the end result here: http://codepen.io/anon/full/jlbck)
I have no idea what I can try to get this working. The problem seems to be that the absolutely positioned li:before element isn't appearing above the li. The css seems fine to me - especially as it works in all newer browsers - but does anyone know of an IE hack that can fix this for IE8?
Edit (sorry, thought it was enough to provide code just in a demo)
HTML:
<ul class="progress">
<li class="first">One</li>
<li class="current">Two</li>
<li>Three</li>
<li class="last">Four</li>
</ul>
CSS:
.progress {
list-style: none;
padding: 0;
height: 24px;
overflow: hidden;
}
.progress li {
display: inline-block;
width: 100px;
text-align: center;
padding: 4px 10px 2px 15px;
margin: 0 1px 0 0;
height: 20px;
position: relative;
background-color: #E4E4E4;
font-size: 13px;
}
.progress li:after {
content:" ";
display: inline-block;
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
border-left: 10px solid #E4E4E4;
position: absolute;
top: 50%;
margin-top: -15px;
left: 100%;
z-index: 3;
}
.progress li:before {
content:" ";
display: inline-block;
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
border-left: 10px solid #fff;
position: absolute;
top: 50%;
margin-top: -15px;
margin-left: 3px;
left: 100%;
z-index: 2;
}
.progress li.first {
padding-left: 10px;
}
.progress li.current {
background-color: #029E4A;
color: #fff;
font-weight: bold;
}
.progress li.current:after {
border-left: 10px solid #029E4A;
}
.progress li.last:before, .progress li.last:after {
display: none;
}
This could be related to the general problem of IE8 struggling with pseudo elements (:before, :after). I have experienced this with font icons. I found this thread helpful: IE8 CSS #font-face fonts only working for :before content on over and sometimes on refresh/hard refresh
This was the solution that I implemented (with YUI):
_redrawIcons: function (node) {
var style;
if (Y.UA.ie === 8) {
style = document.createElement('style');
style.type = 'text/css';
style.styleSheet.cssText = ':before,:after{content:none !important;}';
node.appendChild(style);
setTimeout(function () {
node.removeChild(style);
}, 0);
}
},
I would like to know if (and maybe how) some text-shadow like shown in following image is possible:
The shadow is decreasing over several list-elements. I was thinking to give each element different hover-classes depending on what element is being hovered on, but I am not even sure how to get such decreasing shadows with CSS. Would be really cool if someone would be able to teach me how to do that. If you want you can use my jsfiddle code.
You could try something like this
demo
(click a tab to select it and see the shadows)
and get the effect using box-shadow on pseudo-elements of the selected tab.
Should look like this
HTML:
<ul class='tabs'>
<li><a href='#' tabindex='1'>1st tab</a></li>
<!-- as many tabs as you would like -->
<li><a href='#' tabindex='1'>aaand another tab</a></li>
</ul>
Relevant CSS:
.tabs { overflow: hidden; margin-top: 7em; list-style: none; }
.tabs li { float: left; border-right: 1px dotted #222; }
.tabs a {
display: block;
position: relative;
padding: 1em .66em;
font: .66em/1.1 sans-serif;
text-transform: uppercase;
text-decoration: none;
}
.tabs a:focus {
z-index: 3;
outline: none;
box-shadow: 0 -.5em 1.5em black;
background: lemonchiffon;
}
.tabs a:focus:before, .tabs a:focus:after {
position: absolute;
bottom: -1px;
width: 30em; height: 1px;
box-shadow: 0 0 20px 1px black;
content: '';
}
.tabs a:before {
left: -30.5em;
transform: rotate(-3deg);
transform-origin: 100% 100%;
}
.tabs a:after {
right: -30.5em;
transform: rotate(3deg);
transform-origin: 0 100%;
}
You could augment an <li> to sit within the whole width of the <ul>, rotate it and give it a shadow..
HTML:
...
</li>
<li class="shadow">1</li>
</ul>
CSS:
ul
{
overflow: hidden;
height: 50px;
}
li.shadow
{
width: 100%;
height: 100%;
position: relative;
top: 15px;
box-shadow: 0px 0px 45px #000;
-webkit-transform:rotate(-1deg);
}
http://jsfiddle.net/Kyle_Sevenoaks/4Luet/1/