How to remove the bottom 1px of an inline-block (CSS)? - html

I will refer to this screenshot in my explanation:
I have set up tabs like you see in the picture. I wanted the active tab (home in the picture) to have a 1px black line under it, so I used bottom-border. However, it's difficult to see but the pink-ish background extends for that entire row. I would like the pink to stop drawing at the bottom of a tab, excluding a border if there is one (so just 1px above the bottom).
.main_tabs{
width:100%;
display:inline-block;
background:#FFDEFD;
}
li.active a, li.active{
background:#fff;
color:#4c4c4c;
border-radius: 3px 3px 0px 0px;
border-bottom-color:#000000;
border-bottom-width:1px;
border-bottom-style:solid;
transition:all linear 0.4s;
}
Above is my CSS for main_tabs (which is responsible for that pink background) and the active tab. In main_tabs, I have tried playing around with background-size but it didn't change anything. I tried to fiddle with width and display, but it messed up my tabs entirely.

.main_tabs {
background: #FFDEFD;
list-style: none;
margin: 0;
padding: .25em .5em 0;
}
.main_tabs li {
display: inline-block;
}
.main_tabs a {
display: block;
text-decoration: none;
line-height: 2em;
padding: 0 .5em;
background: #DDD;
border-radius: 3px 3px 0px 0px;
border-bottom: 1px solid transparent;
transition: all linear 0.4s;
}
.main_tabs .active a {
background: #fff;
color: #4c4c4c;
border-bottom-color: black;
}
<ul class=main_tabs>
<li><a href=#>Non active</a></li>
<li class=active><a>Active</a></li>
</ul>

Your border is added in original height of <li> that why it appears like this.
Use css property box-sizing:border-box to merge it in original height.
li.active a, li.active{
background:#fff;
color:#4c4c4c;
box-sizing:border-box;
border-radius: 3px 3px 0px 0px;
border-bottom-color:#000000;
border-bottom-width:1px;
border-bottom-style:solid;
transition:all linear 0.4s;
}

Related

CSS: border-color:inherit

I have a button with border on the right and the bottom, when I hover that, both border is hidden, and show border on the top and the left with color same as background-color on parent that button, i want to make like a 3D button effect, but its not working.
Here's look like my button when i hover it
What i want is the border-color is red, and if the parent background-color is green the border-color is green
And here's my code
.cta {
display: inline-block;
padding: 10px 30px;
font-family: 'courier new' !important;
font-size: 19px !important;
background: #1d85bf;
color:#fff;
border:3px solid #0b527a;
border-top:0;
border-left: 0;
border-radius:3px;
text-transform:uppercase;
display: block;
overflow: hidden;
white-space: nowrap;
}
.cta:hover {
border:3px solid #dbdbdb;
border-color:inherit !important;
border-bottom: 0;
border-right: 0;
border-top-left-radius: 3px !important;
color:#fff;
}
Here's my fiddle https://jsfiddle.net/evpsthx3/
Problem is your parent has no border color set. So just set the border color to the parent. Something like this: https://jsfiddle.net/evpsthx3/9/
<div class="parent red">
<a class="cta">BUTTON</a>
</div>
<div class="parent green">
<a class="cta">BUTTON</a>
</div>
.parent.red {
background-color: red;
border-color: red;
}
.parent.green {
background-color: green;
border-color: green;
}
You can give that effect by adding the below css code, Hope it wrks.
.cta:hover {box-shadow: #000 5px 5px 5px;}
you can try this one:
.parent {
width:300px;
height:60px;
padding:30px;
}
.cta {
display: inline-block;
padding: 10px 30px;
font-family: 'courier new' !important;
font-size: 19px !important;
background: #1d85bf;
color:#fff;
border:3px solid #0b527a;
border-top:0;
border-left: 0;
border-radius:3px;
text-transform:uppercase;
display: block;
overflow: hidden;
white-space: nowrap;
}
.cta:hover {
border:3px solid #dbdbdb;
border-color:inherit !important;
border-bottom: 0;
border-right: 0;
border-top-left-radius: 3px !important;
color:#fff;
box-shadow: #242729 6px 6px 6px;
}
DEMO HERE

CSS - How to color special shape on hover?

I've created a "tag" shape using CSS (the rectangular base + triangle). Since I have more than one tag shape I wanted to add the hover property to the class which defines that shape and that way automatically attach hover to all tags. However, it appears its not working and the only way to apply hover is by id. Why is that? There surely must be an easier way to apply hover to several elements at once.Second question, since tag shape is built using two shapes, how should the hover color transition should be made?
JSfiddle
#q{
position:relative;
margin:0 5px 0 10px;
displaY:inline-block;
height:66px;
padding: 0 35px 0 20px;
font-size: 25px;
line-height:65px;
cursor: pointer;
font-weight: 100;
margin: 20px 25px;
background:#f3f3f3;
transition: background 0.3s;
}
#q:after{
position:absolute;
content:"";
right:-19px;
width: 1px;
height:0px;
border-left:18px solid #f3f3f3;
border-top: 33px solid transparent;
border-bottom: 33px solid transparent;
transition: background 0.3s;
}
#q:hover{
background: green;
border-left:18px solid lightblue;
}
HTML:
<span class="pricetag-right" id="q">tag is here!</span>
DEMO PAGE
#q{
position:relative;
margin:0 5px 0 10px;
displaY:inline-block;
height:66px;
padding: 0 35px 0 20px;
font-size: 25px;
line-height:65px;
cursor: pointer;
font-weight: 100;
margin: 20px 25px;
background:#f3f3f3;
transition: background 0.3s;
}
#q:after{
position:absolute;
content:"";
right:-19px;
width: 1px;
height:0px;
border-left:18px solid #f3f3f3;
border-top: 33px solid transparent;
border-bottom: 33px solid transparent;
transition: border 0.3s;
}
#q:hover{
background: green;
}
#q:hover:after{
border-left-color:green;
}
You needed to set the transition of the :after to border and not background, since it's the border property being transitioned.
Here's a fiddle based on vsync's with class selectors:
https://jsfiddle.net/ajanini/9z3Lvp90/
.pricetag-right{
position:relative;
margin:0 5px 0 10px;
displaY:inline-block;
height:66px;
padding: 0 35px 0 20px;
font-size: 25px;
line-height:65px;
cursor: pointer;
font-weight: 100;
margin: 20px 25px;
background:#f3f3f3;
transition: background 0.3s;
}
.pricetag-right:after{
position:absolute;
content:"";
right:-19px;
width: 1px;
height:0px;
border-left:18px solid #f3f3f3;
border-top: 33px solid transparent;
border-bottom: 33px solid transparent;
transition: border 0.3s;
}
.pricetag-right:hover{
background: green;
}
.pricetag-right:hover:after{
border-left-color:green;
}

css, border over border

I have this design of a table with a menu next to it: fiddle, The problem is that the corners of the #settingNev ul li a is shown on the border-right so there are little white dots and the border the is connected to the menue and the table(you can se the in the fiddle easly).
How can i do hat they wont be? i want that the ul's li background-color will stay white and will not transparent(transparent solves it)?
Also i dont want to set the left,top and bottom borders as 0px becaus ethen when its hover one li the other move
similar to musefans answer but with a fix^^
#settingNev ul li a {
display: block;
border-radius: 6px 0px 0px 6px;
color: #666;
//padding: 5px 3px;
padding: 6px 3px 6px 4px;
border: none;
border-right: 1px solid black;
//margin: 1px 0 1px 1px;
}
#settingNev ul li a:hover {
border: 1px solid black;
border-right: 1px solid white;
//margin: 0;
padding: 5px 3px;
}
#settingNev .active a {
border: 1px solid black;
border-right: 1px solid white;
//margin: 0;
padding: 5px 3px;
}
here is a fiddle(updated)
also you have some duplicated css in you fidle
UPDATE: use padding instead of margin this works now you can see it in my updated fiddle

Padding on link with an image affecting position of parent element(s)

I'm working on a new design for my website to see what I like (touch and feel).
My top navigation bar is great so far, except for this issue.
When you hover over the links with just text, everything is fine.
Top-padding is added to make it look like the navigation tabs "move"/"grow".
However, when I hover over a navigation link with one of my images (Paypal, Twitter, YouTube) in it, the top-padding is applied, but it affects the position of the main parent element. This is in the latest version of Chrome and Firefox for Windows 7.
BODY is not the affected parent, but #main (as defined in my CSS) "moves"/"grows" as well.
The URL is http://rickyyoder.x10.mx/new/ and here is the code:
#main{
width:94%;
max-width:880px;
margin:12px auto;
background:#fff;
box-shadow:1px 1px 4px #000;
border-radius:4px;
padding:2px 2px 8px 2px;
}
#nav{
position:relative;
top:-0.8em;
background:#fff;
border-radius:4px;
padding:2px;
display:inline-block;
}
#nav a{
color:#000;
display:inline-block;
padding:1px 1em 1px 1em;
border-radius:0 0 4px 4px;
box-shadow:0px 2px 2px -2px #fff inset, 0px -4px 16px -6px #aaa inset;
-webkit-transition:background 0.5s, padding-top 0.25s;
-moz-transition:background 0.5s, padding-top 0.25s;
vertical-align:top;
}
#nav a:hover{
padding-top:4px;
background:#eee;
}
#nav a:hover img{
-webkit-transition:-webkit-filter 1.5s;
}
#nav a:hover img{
-webkit-filter:hue-rotate(360deg);
}
Is there any way I can avoid this, but still have a "moving"/"growing" effect on these links as well as the textual links?
Thanks in advance.
You can solve the problem adding height to the nav
#nav {
position: relative;
top: -0.8em;
background: #fff;
border-radius: 4px;
padding: 2px;
display: inline-block;
height: 50px;
}

Adjust position of pagination link

I have the following HTML:
<div id="pager">1
2
3<span class="elip">...</span>
4</div>
And CSS:
.elip
{
padding-top:3px;
letter-spacing:2px;
margin-left:5px;
}
#pager a{
BORDER-BOTTOM: #E6E6E6 1px solid;
BORDER-TOP: #E6E6E6 1px solid;
BORDER-RIGHT: #E6E6E6 1px solid;
BORDER-LEFT: #E6E6E6 1px solid;
color: #585858;
padding: 7px;
padding-top:30px;
text-decoration: none;
color: #808080;
}
No matter what I do, I cannot get the '...' to be aligned down the bottom at the bottom. When testing in JSFiddle, all works, but not outside it as the shot below (red X is what it is, green tick is what I would like):
Padding, text size, alignment, line height, nothing seems to work.
Try this:
.elip {
padding-top:3px;
letter-spacing:2px;
margin-left:5px;
position:relative;
bottom:-10px;
}
You could use relative positioning, I also cleaned up your css a bit: http://jsfiddle.net/ptriek/LfUDB/2/
.elip {
padding-top:3px;
letter-spacing:2px;
margin-left:5px;
}
#pager a {
border: #E6E6E6 1px solid;
color: #808080;
padding:30px 7px 7px 7px;
text-decoration: none;
}
#pager span {
top: 9px;
position:relative;
}