I'd like to add a divider between my page tabs on my blog so it looks like this:
About Me / My Work / Contact / Blog
I don't want the slashes to turn green when they're moused over.
Here's my blog: http://clairestrick.blogspot.com/
I'm really new to this and I'm using the Simple template. Here's the code for the header and tabs:
/* Header
----------------------------------------------- */
.header-outer {
background: $(header.background.color) $(header.background.gradient) repeat-x scroll 0 -400px;
_background-image: none;
}
.Header h1 {
font: $(header.font);
color: $(header.text.color);
text-shadow: $(header.shadow.offset.left) $(header.shadow.offset.top) $(header.shadow.spread) rgba(0, 0, 0, .2);
}
.Header h1 a {
color: $(header.text.color);
}
.Header .description {
font-size: $(description.text.size);
color: $(description.text.color);
}
.header-inner .Header .titlewrapper {
padding: 22px $(header.padding);
}
.header-inner .Header .descriptionwrapper {
padding: 0 $(header.padding);
}
/* Tabs
----------------------------------------------- */
.tabs-inner .section:first-child {
border-top: $(header.bottom.border.size) solid $(tabs.border.color);
}
.tabs-inner .section:first-child ul {
margin-top: -$(header.border.size);
border-top: $(header.border.size) solid $(tabs.border.color);
border-left: $(header.border.horizontalsize) solid $(tabs.border.color);
border-right: $(header.border.horizontalsize) solid $(tabs.border.color);
}
.tabs-inner .widget ul {
background: $(tabs.background.color) $(tabs.background.gradient) repeat-x scroll 0 -800px;
_background-image: none;
border-bottom: $(tabs.border.width) solid $(tabs.border.color);
margin-top: $(tabs.margin.top);
margin-left: -$(tabs.margin.side);
margin-right: -$(tabs.margin.side);
}
.tabs-inner .widget li a {
display: inline-block;
padding: .6em 1em;
font: $(tabs.font);
color: $(tabs.text.color);
border-$startSide: $(tabs.border.width) solid $(content.background.color);
border-$endSide: $(tabs.bevel.border.width) solid $(tabs.border.color);
}
.tabs-inner .widget li:first-child a {
border-$startSide: none;
}
.tabs-inner .widget li.selected a, .tabs-inner .widget li a:hover {
color: $(tabs.selected.text.color);
background-color: $(tabs.selected.background.color);
text-decoration: none;
}
Please try with
<ul>
<li>About Me
<span>/</span></li>
<li>My Work<span>/</span></li>
<li class="selected">Contact <span>/</span></li>
<li>Blog</li>
</ul>
This helps you to add a divider between tabs
.tabs .widget li:after {
content: "/";
}
Related
I am creating a web app (a side project!), I try to make it look good and came across a little CSS challenge 😁, can you help me?
Examples because it's easier with pictures:
Example 1
👎What I get :
👍What I want :
Example 2
👎What I get :
👍What I want :
I hosted a very simple vuejs example here : https://jsfiddle.net/ep8ny04d/3/
li {
margin: 0;
padding: 10px;
border-radius: 10px;
cursor: pointer;
&.active {
background: #39a374;
color: white;
}
}
(My screenshots come from this example.)
So the problem is: Two elements have to be sticked together, but the border-radius of elements have to be changed (or removed for elements in the middle) if two or more elements are selected and next to each other.
Do you think it's possible to do without Javascript?
You can get most of the way there using a combination of sibling combinators, :first-child, :last-child, and :not() (note that you need to remove the border-radius: 10px declaration from the top-level li rule):
li {
margin: 0;
padding: 10px;
cursor: pointer;
&.active {
background: #39a374;
color: white;
}
&.active:first-child, &:not(.active) + .active {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
&.active:last-child {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
}
But that doesn't produce bottom rounded corners for .active items appearing immediately before :not(.active) items. You'd need to add another class to those specific items before you can target them with CSS. This can be done within the class binding so you avoid polluting the data model (or indeed, writing additional application logic, which I assume is what you mean by "without JavaScript"...):
<li v-for="(todo,i) in todos"
v-on:click="toggle(todo)"
v-bind:class="{active: todo.active, beforeInactive: todo.active && todos[i+1] && !todos[i+1].active}">
{{i}} Hey
</li>
Then referenced within the CSS:
li
// ...
&.active:first-child, &:not(.active) + .active {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
// Added reference to new .beforeInactive class
&.active:last-child, &.beforeInactive {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
}
Updated fiddle
As commented, you may play with padding and margin selecting the position first, or last or next siblings:
body {
background: #ffffff;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #68d9a7;
border-radius: 10px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 0;
padding: 10px;
border-radius: 10px;
cursor: pointer;
}
li.active {
background: #39a374;
color: white;
padding-top: 30px;
margin-bottom: -20px;
}
li.active + :not(.active) {
margin-top: 20px;
}
li:not(.active) + .active {
padding-top: 10px;
}
li:last-of-type {
margin: 0;
}
li:first-of-type.active {
padding:10px;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
ol {list-style-type:none;padding:0}
<div id="app"><h2>Todos:</h2> <ol><li class="active">
0 Hey
</li><li class="">
1 Hey
</li><li class="active">
2 Hey
</li><li class=" ">
3 Hey
</li><li class="active">
4 Hey
</li><li class="">
5 Hey
</li><li class="active">
6 Hey
</li><li class="active">
7 Hey
</li></ol></div>
https://jsfiddle.net/1hm9x6do/2/
SCSS for li
li {
margin: 0;
padding: 10px;
border-radius: 10px;
cursor: pointer;
&.active {
background: #39a374;
color: white;
padding-top:30px;
margin-bottom:-20px;
}
&.active + :not(.active) {
margin-top:20px;
}
&:not(.active) + .active {
padding-top:10px;
}
&:last-of-type{
margin:0;
}
&:first-of-type.active {
padding:10px;
}
}
On my website the menu looks fine when you just visit the homepage. As soon as you open one of the menus the selected menu turns to bold and the last menu item jumps to the line below.
I want the menu to be displayed on one line and not jump to the row below, but I can't seem to find the part that's scr*wing me over. Anyone have any suggestions or know what's wrong?
You can reserve space for bolded font through adding not visible after content. Here is JSFiddle http://jsfiddle.net/2r4xby06/1 (demo is on hover)
CSS:
ul {
font:normal 16px Arial;
}
li, a {
display: inline - block;
text - align: center;
}
a {
padding: 4px 8px;
text - decoration: none;
color: #333;
text-transform: uppercase;
}
a:hover {
font-weight:bold;
}
a::after {
display:block;
content:attr(title);
font-weight:bold;
height:1px;
color:transparent;
overflow:hidden;
visibility:hidden;
text-transform: uppercase;
}
HTML:
<ul>
<li>Home</li>
<li>Ploegen</li>
<li>VOOR DE JONGSTEN</li>
<li>KALENDER/STAND</li>
</ul>
Change this
#access .current_page_item > a, #access .current_page_ancestor > a
{
font-weight: bold;
}
To
#access .current_page_item > a, #access .current_page_ancestor > a
{
font-weight: normal;
}
or
#access ul {
font-size: 13px;
list-style: none;
margin: 0 0 0 3em; /*set this to 3em or 3.6em*/
padding-left: 0;
border: 1px solid red;
}
or
#access a {
color: #eee;
display: block;
line-height: 3.333em;
padding: 0 1em; /*set this to 1.2125em to 1em*/
text-decoration: none;
}
#access div {
margin: 0px 8%;
}
This will solve the problem.
When one of the <li> is bold it overflows ( the width becomes bigger ) cause the margins parameters can't be met. So either remove bold or adjust the margins.
In my code I got border-right on all of my li elements. I'm trying to get rid of the border-right when a li element is active using an own made class named active. The problem is that my class does not remove the border-right.
This is a JSFiddle of the code as well: http://jsfiddle.net/t0a4j5tq/2/
div#navbar {
width: 250px;
height: 550px;
float: left;
}
div#navbar > ul {
text-align: center;
background-color: #EEE;
}
div#navbar > ul > li.li, div#navbar > ul > li.liLast {
list-style-type: none;
border-bottom: 1px solid black;
border-right: 1px solid black;
font-size: 25px;
font-family: Algerian, "Times New Roman";
}
div#navbar > ul > li > a {
color: black;
text-decoration: none;
display: block;
width: 100%;
padding: 38px 0;
-webkit-transition: margin-left 0.5s;
}
div#navbar > ul > li > a:hover {
color: white;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black, 0 0 5px black;
margin-left: 5px;
}
li.active {
box-shadow: inset 3px 3px 10px #333;
border-right: none;
}
<div id="navbar">
<ul>
<li class="li active">Start</li>
<li class="li">Om mig</li>
<li class="li">Vision</li>
<li class="li">Tjänster</li>
<li class="liLast">Kontakt</li>
</ul>
</div>
The root of your problem is CSS Specificity. This is important to understand, because simply using !important in your code is a hack and can cause you to have problems later on if you forget that you put it there.
!important overrides everything, and so obviously should not be used except in dire, last-resort situations (and even then, many people [myself included] would argue that you should figure out how to fix the problem anyway instead of using !important).
Earlier in your code, you have a CSS selector for the same element (and similar elements):
div#navbar > ul > li.li {
Now, you are trying to access the same element with just this:
li.active {
But the first selector is way more specific. Instead, you should use the following CSS selector, without the !important hack:
div#navbar > ul > li.active {
Hi solution is simple you just need to inform that this change is "important" :P
li.active {
box-shadow: inset 3px 3px 10px #333;
border-right-style: none !important;}
Hope this helps :)
I have following HTML:
<!doctype html>
<html>
<head>
<link rel="stylesheet/less" href="assets/stylesheets/style.less" />
<script src="assets/stylesheets/vendor/less/less-1.3.0.min.js"></script>
</head>
<body>
<nav>
<ul class="tabs">
<li class="selected">
Foo
</li>
<li>Bar</li>
<li>Baz</li>
</ul>
<nav>
</body>
</html>
How should I write my style.less to style the list as Twitter Bootstrap Basic Tab. The obvious way
to do this, to copy and paste all relevant css:
$cat style.less
#import "vendor/bootstrap/less/bootstrap.less";
.tabs {
// .nav
margin-left: 0;
margin-bottom: #baseLineHeight;
list-style: none;
// common style for tabs and pills
.clearfix();
// Give the tabs something to sit on
border-bottom: 1px solid #ddd;
}
.tabs > li {
float: left;
}
// Make links block level
.tabs > li > a {
display: block;
}
.tabs > li > a:hover {
text-decoration: none;
background-color: #grayLighter;
}
// common style for nav-tabs
.tabs > li > a {
padding-right: 12px;
padding-left: 12px;
margin-right: 2px;
line-height: 14px; // keeps the overall height an even number
}
// Make the list-items overlay the bottom border
.tabs > li {
margin-bottom: -1px;
}
// Actual tabs (as links)
.tabs > li > a {
padding-top: 8px;
padding-bottom: 8px;
line-height: #baseLineHeight;
border: 1px solid transparent;
.border-radius(4px 4px 0 0);
&:hover {
border-color: #grayLighter #grayLighter #ddd;
}
}
// Active state, and it's :hover to override normal :hover
.tabs > .selected > a,
.tabs > .selected > a:hover {
color: #gray;
background-color: #white;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
Is there any better way to achieve this, without much copy and paste? Note: I
can not change the HTML file.
I end up by rewriting or overriding bootstrap/less/navs.less (see: HTML and less files ) to make it mixable and Allow appropriate LESS classes to be mixed-in
$cat vendor/bootstrap/less/navs.less
// NAVIGATIONS
// -----------
// BASE CLASS
// ----------
.nav {
margin-left: 0;
margin-bottom: #baseLineHeight;
list-style: none;
> li {
> a {
display: block; // Make links block level
}
> a:hover {
text-decoration: none;
background-color: #grayLighter;
}
}
}
.nav-tabs {
.clearfix();
border-bottom: 1px solid #ddd; // Give the tabs something to sit on
> li {
float: left;
margin-bottom: -1px; // Make the list-items overlay the bottom border
> a {
padding-right: 12px;
padding-left: 12px;
margin-right: 2px;
line-height: 14px; // keeps the overall height an even number
padding-top: 8px;
padding-bottom: 8px;
line-height: #baseLineHeight;
border: 1px solid transparent;
.border-radius(4px 4px 0 0);
&:hover {
border-color: #grayLighter #grayLighter #ddd;
}
}
}
}
.nav-tabs {
// Active state, and it's :hover to override normal :hover
> .active {
> a, a:hover {
color: #gray;
background-color: #white;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
}
}
$ cat style.less
#import "vendor/bootstrap/less/bootstrap.less";
.foo {
.nav;
.nav-tabs;
}
.foo > .bar {
.nav-tabs > .active;
}
Your example doesn't work, sorry
But I'm highly interested in this subject. I wanna colaborate
In my opinion there is no point of discussion about giving that path
First we mix content and style in a page
Then they made css in order to separate both
Now we mix again style (to put a tag in the class of an object IS mix'em) and content together
So, lets separate'em again bro!
This works fine in Firefox, but top section doesnt work on IE. I have looked through other responses and tried to add line-height=1; but didnt work.
The problem is the Top header, should be red white and blue, like firefox. On IE is black, black, then blue.
#ja-header-a {background:url(../images/header-bg.png)repeat-x bottom #B70000;}
#ja-header-a .main {padding:15px 0;}
#ja-header-b {}
Here is the link to the test site, try opening it in IE then firefox.
http://www.alumnifootballusa.com.php5-21.dfw1-1.websitetestlink.com/index.php/123
Here is the full code:
*==========general==========*/
body {font-family:Verdana, Arial, sans-serif;}
body#bd {}
#ja-wrapper {}
#ja-inwrapper { }
#ja-right {
background-color: #000000; }
/*==========header==========*/
#ja-header-a {background:url(../images/header-bg.png) repeat-x 0 bottom #B70000;}
#ja-header-a .main {padding:13px 0;}
#ja-header-b {}
h1.logo, div.logo-text h1 {font-size: 250%; line-height: 1; margin-left: -65px; margin-bottom: -50px; }
/*logo image*/
h1.logo { }
h1.logo a,
h1.logo-offline {background: url(../images/logo.png) no-repeat left;display: block;}
h1.logo-offline {margin:0 auto 25px auto;text-indent:-2000px; overflow:hidden;}
/*logo text*/
div.logo-text h1 {font-size: 200%;font-family: Arial, sans-serif;font-weight: bold;}
div.logo-text h1 a {text-decoration: none;}
p.site-slogan {color: #ccc;display: block;font-size: 85%;margin: 3px 0 0;padding: 0 10px;text-transform: uppercase;}
/*header tools*/
#ja-tools {position:absolute;right:35px;bottom:35px;text-align:right;}
#ja-tools ul.tool-list {float:right;text-align:right;}
#ja-tools > ul.tool-list > li {float:right;margin-left:20px;}
.topnav {margin-top:5px;}
.topnav ul {text-align:right;}
.topnav ul li {
display:inline;
padding: 0 10px 1px 9px;
background:url(../images/border-top-menu.png) no-repeat right center;
}
.topnav ul li:last-child {background:0; }
.topnav ul li a {}
/*==========navigation==========*/
#ja-mainnav {background:url(../images/nav-border.png) repeat-x bottom;padding-bottom:1px;}
#ja-mainnav .wrap-inner1 {padding:12px 0 0 0;}
#ja-mainnav .wrap-inner1 > .main {right:-165px; bottom: 5px;}
#ja-mainnav .main {}
#ja-mainnav .main .main-inner1 {}
.menu-desc {font-size:11px!important;}
#ja-subnav {background:url(../images/drop-menu-bg.png) repeat-x top;}
/*==========main featured==========*/
#ja-featured {background:url(../images/featured-bg.png) repeat-x bottom;padding:20px 0 45px 0;}
/*==========main container==========*/
#ja-container {}
#ja-container .content-wrap1 {background: url(../images/content-bg-bottom.png) repeat-x bottom; }
#ja-container .main {}
.main .main-inner1 { margin-left: 0; margin-right: 0; }
/*==========spotlights==========*/
#ja-topsl-a,
#ja-topsl-b,
#ja-botsl-a,
#ja-botsl-b {padding:10px 0!important;}
#ja-topsl-a .ja-box,
#ja-topsl-b .ja-box,
#ja-botsl-a .ja-box { background:0;}
#ja-botsl-b .ja-box {}
#ja-topsl-a .ja-box-right,
#ja-topsl-b .ja-box-right,
#ja-botsl-a .ja-box-right,
#ja-botsl-b .ja-box-right { background: 0;}
#ja-topsl-a .ja-moduletable,
#ja-topsl-b .ja-moduletable,
#ja-botsl-a .ja-moduletable,
#ja-botsl-b .ja-moduletable {margin-top: 10px;margin-bottom:0!important;padding-bottom:0!important;}
/*top spotlights*/
#ja-topsl-a .main,
#ja-topsl-b .main { padding: 0; }
#ja-topsl-b {
background:url(../images/topsl-bottom-bg.png) repeat-x bottom;
padding-bottom:30px!important;
margin-bottom:20px;
}
/*==========bottom==========*/
#ja-bottom {
color:#bdbbbb;
text-shadow: 0 1px 1px #000;
background-image:url(../images/grad-bottom.png);
background-repeat:no-repeat;
background-position:center top;
}
#ja-bottom .bottom-wrap1 {
background:url(../images/bottom-top-bg.png) repeat-x top;
padding-top:30px;
}
/*bottom spotlights*/
#ja-botsl-a .main,
#ja-botsl-b .main { padding: 0 0 15px 0; }
#ja-botsl-a .main-inner1 {}
#ja-botsl-b .main-inner1 {}
#ja-botsl-b { }
/*==========footer==========*/
#ja-footer { background:url(../images/footer-bg.png);margin-bottom:35px;padding:0;}
#ja-footer .wrap-inner1 { background:url(../images/footer-border.png) repeat-x top;}
#ja-footer .wrap-inner2 { background:url(../images/footer-border.png) repeat-x bottom; padding:20px 0;}
#ja-footer .main { padding: 0; position: relative; text-align: left; }
#ja-footer .inner { padding: 0; }
#ja-footer small { font-size: 100%; }
/*footnav*/
#ja-footer .ja-footnav { font-size: 100%; margin: 0; overflow: hidden; position: relative; }
.ja-footnav ul { line-height: normal;text-align:right;float:right;margin-right:15px; }
.ja-footnav li { display: inline; padding: 0 5px; }
.ja-footnav li a { }
.ja-footnav li a:hover,
.ja-footnav li a:active,
.ja-footnav li a:focus { }
/*copyright*/
.ja-copyright { float:left;width:48%; }
.ja-copyright small { display: block;padding-left:15px; }
/*==========miscellanous==========*/
#ja-poweredby {position:absolute;left:450px;top:0; }
.t3-logo-dark-sm a {background-image: url(../images/t3-logo.png) !important;}
#ja-top-panel .main-inner1 {border: 2px dotted #e2e2b5;padding: 5px 10px;text-align: center;margin-top: 15px;background: #ffffcc;position: relative;}
#ja-banner {border-top: 1px solid #ccc; }
div.ja-innerdiv {border-bottom: 1px dotted #ccc; }
div.ja-innerdiv h4 {font-family: Helvetica, Arial, sans-serif;font-size: 92%;font-weight: normal;text-transform: uppercase;}
a.ja-icon-video {background: url(../images/icon-youtube.gif) no-repeat 5px 8px #fff;border: 1px solid #ccc;color: #666;display: block;font-weight: bold;position: absolute;padding: 5px 5px 5px 43px;right: 10px;top: 8px;text-decoration: none;width: 35px;border-radius: 5px;-moz-border-radius: 5px;-webkit-border-radius: 5px;box-shadow: 0 0 3px rgba(0, 0, 0, .2);-moz-box-shadow: 0 0 3px rgba(0, 0, 0, .2);-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .2);}
a.ja-icon-video span { color: #666; }
a.ja-icon-video:hover,
a.ja-icon-video:focus,
a.ja-icon-video:active { border-color: #ddd; text-decoration: none; }
a.ja-icon-video:hover span { color: #0F85D8; }
#ja-absolute .main {position: fixed;width: auto;height: auto;z-index: 99999;top: 1px;left: 1px;}
#ja-absolute .main a {width: 91px;height: 99px;overflow: hidden;display: block;background: url(../images/joomla15.png) no-repeat left top #fff;text-indent: -9999px;}
#ja-absolute .main a:hover,
#ja-absolute .main a:focus {background-position: left bottom;text-decoration: none;}
I think your problem might be background shorthand which is not properly formatted. Firefox might work around it but IE is really picky.
background:url(../images/header-bg.png)repeat-x bottom #B70000;
Usually you should write the background shorthand like:
background: <color> || <image> || <repeat> || <attachment> || <position>;
So:
background: #b70000 url(../images/header-bg.png) repeat-x bottom;
Try to add the !DOCTYPE deceleration before the <html> tag
IE8 doesnt seem to pick up the css rule for #ja-header-a.
I think the syntax is wrong.
Try the following
#ja-header-a {background:url(../images/header-bg.png) repeat-x 0 bottom #B70000;}