I have a hover effect that moves a new background-color over an existing one, making it appear the background is fading to the right. For some reason a bit of the background-color is showing on the left side of the blocks.
The only thing I could think of was my black border, but I have a border set in the elements natural style.
Does anyone know what is causing this?
#service-tabs-left {
float: left;
margin-left: 150px;
}
#service-tabs-right {
float: right;
margin-right: 150px;
}
.service-tab-block {
position: relative;
font-size: 1.6em;
padding: 1em 25px;
text-align: center;
display: block;
margin: 30px 0;
cursor: pointer;
border: 1px solid #838557;
background-image: linear-gradient(to right, #000 50%, #838557 50%);
background-size: 200% 100%;
background-repeat: no-repeat;
background-position: bottom right;
transition:width 0.2s ease;
-webkit-transition:width 0.2s ease;
}
.service-tab-block.active {
background: #000;
color: #FFF;
}
.service-tab-block:hover {
-webkit-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;
background-position: bottom left;
color: #FFF;
border: 1px solid #000;
}
<div id="service-tabs-left">
<h1 class="service-tab-block" id="service_tab1">DEMOLITION</h1>
<h1 class="service-tab-block" id="service_tab2">ENVIRONMENTAL SOLUTIONS</h1>
<h1 class="service-tab-block" id="service_tab3">CONCRETE CRUSHING</h1>
</div>
<div id="service-tabs-right">
<h1 class="service-tab-block" id="service_tab4">ASSET RECOVERY</h1>
<h1 class="service-tab-block" id="service_tab5">SCRAP METAL RECYCLING</h1>
<h1 class="service-tab-block" id="service_tab6">FOUNDATION REMOVAL</h1>
</div>
You have to change the background-size property from 200% to 201%. The extra 1% gives the cover you need.
https://jsfiddle.net/o7sxoton/
I fixed it by changing the linear gradient for black to 49% on .service-tab-block
BTW , this is one of those issues you can see by adjusting your browsers zoom for anyone who was wondering.
.service-tab-block {
background-image: linear-gradient(to right, #000 49%, #838557 50%);
Set this:
.service-tab-block{
box-sizing:border-box;
-moz-box-sizing:border-box;
}
Related
I am trying to make a text color change either bottom up or up to bottom on hover.
.box {
width: 200px; height: 100px;
background-size: 100% 200%;
background-image: linear-gradient(to bottom, red 50%, green 50%);
-webkit-transition: background-position 1s;
-moz-transition: background-position 1s;
transition: background-position 1s;
}
.box:hover {
background-position: 0 -100%;
}
<div class="box">Text</div>
the above code makes the box change color instead the text. What can I do to make the text color instead of the box.
You gotta use Background Clip:
.box {
width: 200px;
height: 100px;
background-size: 100% 200%;
background-image: linear-gradient(to bottom, red 50%, green 50%);
-webkit-transition: background-position 3s;
-moz-transition: background-position 3s;
transition: background-position 3s;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: bold;
font-size: 50pt;
}
.box:hover {
background-position: 0 -100%;
}
<div class="box">Text</div>
Note: I have increased the font size and time to 3 seconds to see the effect well.
You can achieve the effect using an overlay (the before pseudo element) with the background, and mix-blend-mode: screen:
.box {
position: relative;
width: 200px;
height: 100px;
font-size: 5em;
background: white;
}
.box::before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 100% 200%;
background-image: linear-gradient(to bottom, red 50%, green 50%);
transition: background-position 1s;
content: '';
pointer-events: none;
mix-blend-mode: screen;
}
.box:hover::before {
background-position: 0 -100%;
}
<div class="box">Text</div>
I am trying to mask image (with text shadow) using CSS property -webkit-mask-image.
I understand that I can use background-clip however I need to do this using only mask-image
property for some reason. However upon trying it out I was stack with some CSS codes.
here's my CSS code:
#masking h1, span.mask-text {
font-size: 230px;
font-family: 'Lilita One', sans-serif;
text-align: center;
margin: 0 auto;
padding: 0;
-webkit-text-fill-color:transparent;
position:absolute;
left: 100px;
}
#masking h1 {
text-shadow: 3px 3px 0px #34495e;
z-index:2;
}
span.mask-text {
-webkit-mask-image: url('http://halloweenmaternitycostumes.com/wp-content/uploads/2014/11/paper.jpg') no-repeat center center;
background-size: cover;
z-index:5;
-webkit-transition:all 0.7s ease;
-moz-transition:all 0.7s ease;
-o-transition:all 0.7s ease;
transition:all 0.7s ease;
}
span.mask-text:hover{
cursor: pointer;
-webkit-mask-image: ('http://halloweenmaternitycostumes.com/wp-content/uploads/2014/11/paper-hover.jpg') no-repeat center center;
background-size: cover;
z-index:5;
}
span.mask-text:after {
content: 'Mask Text';
text-transform: uppercase;
}
Here's an image what I am trying to do:
Here's the jsFiddle version: http://jsfiddle.net/cmtr3txu/2/
If you could show me the solution using jsFiddle that would be great.
I updated your code here:
http://jsfiddle.net/cajvgkxt/3/
To add a background to the text, do as follows... Note: background must come before clipping!
span{
font-size: 50px;
font-family: Helvetica, Arial;
background: url(http://www-users.cs.umn.edu/~interran/texture/lic2.gif);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<span>Text</span>
Your code does two things novel-- animation and text-shadow. For the text-shadow, I made sure that your span and h1 both had font-weight:bold (by default, one is bold and the other is not). For the animation, I left it up to you to customize. You'll need to change the easing and background position.
I'm trying to do a simple animation using only css. The idea is that when I hover a social icon it will seem like it's lifting up. I managed to do that but now i want to use "border" to seem like it's the icon's shadow. I reduced the thickness of the border on hover but I wanted to make it seem more realistic and somehow reduce the width of the border when hovering over. Any ideas?
Here is my fiddle: http://jsfiddle.net/Iulius90/sck4Lzz9/
html
<div>
<img src="http://fc05.deviantart.net/fs70/f/2012/204/7/b/logo_skype_by_jackal807-d58ctxc.png">
</div>
css
div {
width:200px;
height:200px;
background-color:tomato;
}
img {
width: 100px;
height:100px;
margin: 50px;
border-bottom: 3px solid #222;
transition: all 0.35s ease;
}
div img:hover {
margin-top: 22px;
padding-bottom:28px;
border-bottom: 1px solid #222;
transition: all 0.35s ease;
cursor: pointer;
}
You can simply use a solid linear gradient as a background image, and manipulate its dimensions upon hover. Note: You might want to use vendor prefixes to generate CSS gradients that are cross browser compatible.
img {
background-image: linear-gradient(to top, rgba(0,0,0,.5) 0%, rgba(0,0,0,.5) 100%);
background-position: center bottom;
background-repeat: no-repeat;
background-size: 100% 3px;
width: 100px;
height:100px;
margin: 50px;
transition: all 0.35s ease;
}
div img:hover {
background-size: 50% 1px;
margin-top: 22px;
padding-bottom:28px;
transition: all 0.35s ease;
cursor: pointer;
}
http://jsfiddle.net/teddyrised/sck4Lzz9/26/
I got it myself and wanted to leave this for later people having the same question. So no need to waste your precious time answering this question.
OK, so I have a fixed bottom menu bar. It has a popup menu and it's currently not hidden at any point because it is not necessary yet. This bar is fixed in the bottom of the page and it has a popup box. The problem is that I can't get the popup placed above the actual button.
Here's my code:
HTML
<div id="quickBar">
<div id="menuCont">
<div id="quickBarMenu">
<p>Navigation</p>
<ul>
<li><p>Articles</p></li>
<li><p>Blog</p></li>
<li><p>Software</p></li>
<li><p>Featured</p></li>
</ul>
</div>
</div>
</div>
CSS
#quickBar{
width: 100%;
height: 50px;
position: fixed;
display: absolute;
z-index: 200;
bottom: 0;
background-color: grey;
background-image: -webkit-linear-gradient(bottom,rgba(59,70,71,0.4) 0%,rgba(59,70,71,0.4) 45%,rgba(59,70,71,0.2) 55%);
background-image: -o-linear-gradient(top,rgba(59,70,71,0.4) 0%,rgba(59,70,71,0.4) 45%,rgba(59,70,71,0.2) 55%);
background-image: -moz-linear-gradient(top,rgba(59,70,71,0.4) 0%,rgba(59,70,71,0.4) 45%,rgba(59,70,71,0.2) 55%);
background-image: linear-gradient(to top, rgba(59,70,71,0.4) 0%,rgba(59,70,71,0.4) 45%, rgba(59,70,71,0.2) 55%);
opacity: 0.95;
display: none;
}
#quickBar > #menuCont{
width: 960px;
height: 50px;
margin: auto;
color: white;
}
#menuCont > div{
float: left;
}
#quickBarMenu{
width: 183px;
}
#quickBarMenu p{
width: 183px;
height: 20px;
padding: 15px 0;
text-align: center;
transition: background 0.2s linear 0s, color 0.2s linear 0s;
-moz-transition: background 0.2s linear 0s, color 0.2s linear 0s;
-webkit-transition: background 0.2s linear 0s, color 0.2s linear 0s;
}
#quickBarMenu > ul{
/*display: none;*/
list-style: none;
}
I hope someone could help me with this.
OK, I got it myself by using a negative margin of margin-top with the value -200px (4 x 50px).
So I am having trouble getting the transition to work here, on hover works to switch the images, and I have used this transition another site and works just fine when used on the same machine and browser however on this site I am building currently the transition is not having it.... Here is the HTML& CSS
<div class="grid_4">
<h3 class="foot">
Say Hello!
</h3>
<h3 class="descripfoot">
<div class="grid_2">
<a class="testicon" title="flickr Link" align="left" href="http://www.flickr.com"></a>
</div>
some description text goes hereeeee
</h3>
</div>
a.testicon
{
background: url("../images/testicon.png");
width:140px;
height: 140px;
border-radius: 7px 7px 7px 7px;
display: inline-block;
}
a.testicon:hover,a.testicon:focus,a.testicon:active
{
width:140px;
height: 140px;
border-radius: 7px 7px 7px 7px;
display: inline-block;
-webkit-transition: background .3s linear 0s;
-moz-transition: background .3s linear 0s;
background: url("../images/testicon2.png");
}
This works fine for me: http://jsfiddle.net/LWsVt/2/
a.testicon
{
background: url(http://lorempixel.com/200/200) center center no-repeat;
background-size: 200px 200px;
width:140px;
height: 140px;
border-radius: 7px 7px 7px 7px;
display: inline-block;
-webkit-transition: background .3s linear 0s; /* obviously declare all vendor prefixes here */
}
a.testicon:hover,a.testicon:focus,a.testicon:active
{
background-image: url(http://lorempixel.com/400/400);
outline:none;
}
Note I simplified the CSS and got rid of redundant property declarations.