I want to show panel1(div) when I hover button1, show panel2(div) when I hover button2. But the problem now is that the panel won't align top with the button. I've tried "Vertical-Align, Align-items", still couldn't figure out how to do it, please help!
But it always display like this:
Here is my code
HTML:
<div class="Nav">
<span id='Span_Nav'>
<button class="Btn_Nav" id="Btn_Nav_Equipment" >
<div class="Panel_Nav" id='Panel_Equipment'></div>
<span>
<label class="Lb_Nav">Equipment</label>
</span>
</button>
<button class="Btn_Nav" id="Btn_Nav_Report">
<div class="Panel_Nav" id='Panel_Report' ></div>
<span>
<label class="Lb_Nav">Report</label>
</span>
</button>
</span>
</div>
CSS:
.Btn_Nav{
width: 100%;
background: transparent;
background-color: transparent;
display: inline-block;
outline: none;
border: 0;
height: 6vh;
}
.Btn_Nav > span{
background: transparent;
background-color: transparent;
display: inline-block;
outline: none;
}
.Btn_Nav > span > label.Lb_Nav{
color: white;
background: transparent;
background-color: transparent;
display: inline-block;
}
#Span_Nav{
position: absolute;
width: 100%;
top:10vh;
}
button > div.Panel_Nav {
margin-top: 0;
position: absolute;
z-index: 1;
transition-timing-function: ease;
transition: linear .3s;
vertical-align: top;
visibility: hidden;
opacity: 0;
left: 100%;
width: 500%;
height: 6vh;
background: #0f5787;
border: 2px solid;
outline: none;
}
button:hover > div.Panel_Nav {
visibility: visible;
opacity: 1;
}
Check your answer here https://jsfiddle.net/g3yL9cro/1/
.Btn_Nav{
position: relative;
}
button:hover > div.Panel_Nav {
top: 0px;
}
Update 2: Based on OP's fiddle
.Btn_Nav > span{
background: transparent;
background-color: transparent;
display: inline-block;
outline: none;
}
.Btn_Nav > span > label.Lb_Nav{
background: transparent;
background-color: transparent;
display: inline-block;
}
#Span_Nav{
position: absolute;
width: 100px;
top:10px;
}
button > div.Panel_Nav {
margin-top: -2px;
position: absolute;
z-index: 1;
transition-timing-function: ease;
transition: linear .3s;
visibility: hidden;
opacity: 0;
left: 100%;
width: 500%;
height: 20px;
background: #0f5787;
outline: none;
}
button:hover > div.Panel_Nav {
visibility: visible;
opacity: 1;
}
Update 1:
CSS code
body {
padding: 5px;
background: blue;
}
.Btn_Nav{
width: 10%;
background: #eee;
background-color: #eee;
display: block;
margin: 20px;
border: 0;
height: 100%;
}
.Btn_Nav > span > label.Lb_Nav{
color: #333;
background: transparent;
background-color: transparent;
display: block;
}
#Span_Nav{
position: absolute;
width: 100%;
}
button > div.Panel_Nav {
margin-top: -2px;
position: absolute;
z-index: 1;
transition-timing-function: ease;
transition: linear .3s;
vertical-align: top;
display: none;
opacity: 0;
left: 12%;
width: 50%;
height: 18px;
background: #0f5787;
}
button:hover > div.Panel_Nav {
display: block;
opacity: 1;
}
Adding a top value fixes the issue.
button:hover > div.Panel_Nav {
visibility: visible;
opacity: 1;
top: 0;
}
Related
Im new to css and html and im trying to make a good looking website for my FiveM RP Server, and im having issues with the buttons
a:visited {
color: white;
text-decoration: none;
}
a:link {
color: white;
text-decoration: none;
}
a:after {
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
a:hover {
color: green;
border-bottom: 3px solid #004F10;
transform: scaleX'(1);
}
a:active {
color: darkgreen;
}
<header>
<ul>
<h2>Home</h2>
<h2>Rules</h2>
<h2>Discord</h2>
</ul>
</header>
I have displayed the "a" tag as an inline-block so that it doesn't occupy the whole container width.
In your code, you forgot to add content property. And the hover is applied to the ::after selector of the "a" tag not the "a" tag itself. Here is the fix to your code.
a{
display: inline-block;
color: white;
text-decoration: none;
}
a::after {
display: block;
content: '';
border-bottom: solid 3px darkgreen;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
a:hover::after{
transform: scaleX(1);
}
a:active{
color: darkgreen;
}
a:visited{
color: white;
text-decoration: none;
}
Check this CodePen from Peter, he did exactly what you want.
Code:
<nav>
<div id="wrapper">
<ul>
<li>item1</li>
<li>item2</li>
<li class="different">item3</li>
<li class="different">item4</li>
</ul>
</div>
</nav>
CSS:
body, html{
width:100%;
height:100%;
background-color: #999999;
}
*{
box-sizing:border-box;
margin:0;
padding:0;
list-style:none;
font-family: Helvetica;
}
nav{
width: 100%;
height: 50px;
position: fixed;
top: 0;
left:0;
background-color: #333333;
}
#wrapper{
width: 100%;
height: 100%;
overflow: hidden;
display: block;
float: left;
}
#wrapper ul{
diplay: block;
width: 50%;
margin: 0 auto;
height: 100%;
text-align: center;
}
#wrapper li{
display: block;
float: left;
text-align: center;
width: 25%;
height: 100%;
transition: all ease-in-out .2s;
}
#wrapper a{
display: block;
float: left;
color: white;
width: 100%;
padding: 0 .5em;
line-height: 50px;
text-decoration: none;
font-weight: bold;
}
li.different{
border:none;
position: relative;
}
li.different:hover{
border: none;
}
li:hover {
border-bottom: 5px solid #FFFFFF;
}
.different::after{
content: '';
position: absolute;
width: 0px;
height: 5px;
left: 50%;
bottom:0;
background-color: white;
transition: all ease-in-out .2s;
}
.different:hover::after{
width: 100%;
left: 0;
}
CodePen
There are total 3 animation.
1st with default top-down animation.
2nd with fade animation
3rd with fade and scale animation.
.main-container{
display: flex;
}
/* First tag */
.testAni {
font-size: 50px;
display: inline-block;
position: relative;
color: darkgreen;
text-decoration: none;
margin-right: 20px;
}
.testAni:after {
content: '';
position: absolute;
border-bottom: 5px solid darkgreen;
width: 100%;
left: 0;
top: 30px;
transition: 0.5s all ease;
}
.testAni:hover:after {
top: 100%;
}
/* Second tag */
.testAni2:after {
content: '';
position: absolute;
border-bottom: 5px solid darkgreen;
width: 100%;
left: 0;
top: 30px;
transition: 0.5s all ease;
opacity: 0;
}
.testAni2:hover:after {
top: 100%;
opacity: 1;
}
/* Third tag */
.testAni3:after {
content: '';
position: absolute;
border-bottom: 5px solid darkgreen;
transform: scale(0.1);
left: 0;
top: 30px;
transition: 0.5s all ease;
opacity: 0;
}
.testAni3:hover:after {
top: 100%;
transform: scale(1);
opacity: 1;
}
<div class="main-container">
<h2><a class="testAni" href="index.html">Home</a></h2>
<h2><a class="testAni testAni2" href="index.html">Home</a></h2>
<h2><a class="testAni testAni2 testAni3" href="index.html">Home</a></h2>
</div>
What I want to do in the bigger picture is delay the popup for a few seconds after page-load using pure CSS. I've decided the best way to do that is by transitioning the opacity, then using transition-delay to delay it for a few seconds.
My problem is that transition doesn't work and won't delay the popup (nor the dark overlay).
Why is that and how can I fix it?
If it's not possible, is there another way to delay the popup for a few seconds?
hr {
clear: both;
margin-top: 15px;
margin-bottom: 15px;
border: 0;
border-top: 1px solid #aaaaaa;
}
#css-only-modals {
position: fixed;
pointer-events: none;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 10000000;
text-align: center;
white-space: nowrap;
height: 100%;
}
#css-only-modals:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -0.25em;
}
.css-only-modal-check {
pointer-events: auto;
}
.css-only-modal-check:checked~.css-only-modal {
/* FOR TRANSITION */
opacity: 1;
transition: opacity 3s;
/*NOT WORKING */
pointer-events: auto;
}
.css-only-modal {
width: 360px;
background: #FFF;
z-index: 1;
display: inline-block;
position: relative;
pointer-events: auto;
padding: 25px;
text-align: right;
border-radius: 4px;
white-space: normal;
display: inline-block;
vertical-align: middle;
opacity: 0;
pointer-events: none;
}
.css-only-modal h2 {
text-align: left;
color: #1A1A1C;
}
.css-only-modal p {
text-align: left;
}
.css-only-modal-close {
position: absolute;
top: 25px;
right: 25px;
}
.css-only-modal-check {
display: none;
}
.css-only-modal-check:checked~#screen-shade {
/* FOR TRANSITION */
opacity: 0.5;
transition: opacity 3s;
/*NOT WORKING */
pointer-events: auto;
}
#screen-shade {
opacity: 0;
background: #000;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
pointer-events: none;
transition: opacity 0.8s;
}
.stripe>.container>p,
.stripe>.container>ul {
text-align: left;
padding: 35px;
margin: 0;
}
#nav-spacer {
display: block;
height: 50px;
}
.stripe {
width: 100%;
text-align: center;
overflow: hidden;
}
.css-only-modal-btn {
background-color: #BD2C15;
color: white;
padding: 8px 18px;
letter-spacing: 0.5px;
}
.css-only-modal-btn:hover {
color: #BD2C15;
background-color: transparent;
outline: 2px solid #BD2C15;
transition: background-color 0.5s, color 0.5s;
}
<label for="modal1">
<div id="css-only-modals">
<input id="modal1" class="css-only-modal-check" type="checkbox" checked/>
<div class="css-only-modal">
<label for="modal1" class="css-only-modal-close"><i class="fa fa-times fa-2x"></i></label>
<h2>Referral</h2>
<hr />
<p>Refer a customer, email me and receive a 25% commission. <br> Earn up to 1225$ from a single referral!</p>
<hr />
<label for="modal1" class="css-only-modal-btn">NICE!</label>
</div>
<div id="screen-shade"></div>
</div>
</label>
In the CSS I created two comments "FOR TRANSITION". They mark the opacities I want to transition.
Put the transition on your initial element.
.css-only-modal-check {
pointer-events: auto;
}
.css-only-modal-check ~ .css-only-modal {
/* FOR TRANSITION */
transition: opacity 3s;
}
.css-only-modal-check:checked ~ .css-only-modal {
opacity: 1;
pointer-events: auto;
}
.css-only-modal {
width: 360px;
background: #FFF;
z-index: 1;
display: inline-block;
position: relative;
pointer-events: auto;
padding: 25px;
text-align: right;
border-radius: 4px;
white-space: normal;
display: inline-block;
vertical-align: middle;
opacity: 0;
pointer-events: none;
}
Also make sure to keep the transition always set, only change the opacity to 0 on ~checked.
Also transition-delay must be underneath the transition.
here is the full modified code
.css-only-modal-check {
pointer-events: auto;
}
.css-only-modal-check ~ .css-only-modal {
/* FOR TRANSITION */
transition: opacity 3s;
}
.css-only-modal-check:checked ~ .css-only-modal {
opacity: 0;
pointer-events: auto;
}
.css-only-modal {
width: 360px;
background: #FFF;
z-index: 1;
display: inline-block;
position: relative;
pointer-events: auto;
padding: 25px;
text-align: right;
border-radius: 4px;
white-space: normal;
display: inline-block;
vertical-align: middle;
/*opacity: 0;*/
transition: opacity 3s;
transition-delay:2s;
pointer-events: none;
}
Good Afternoon,
I realize this topic has been asked several times and has got several solutions to as I have seen from searching your forums.
But solutions such as,
<input type="button" value="Click Me" **style="float: right;"**>,
Even though do successfully align the button to the right, they overlap my footer as the button is supposed to be right above the footer. This is my code:
.button {
border-radius: 4px;
background-color: #0FA0FF;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 15px;
padding: 10px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.containers-fluid {
padding: 20px 50px;
background-color: #000000;
color: white;
}
<button class="button"><span>Proceed to Next Lesson </span>
</button>
<footer class="containers-fluid text-center">
</footer>
Just add style float:right to your button
add this between button and footer
<div class="clearfix"></div>
and css for clearfix
.clearfix{
clear: both;
}
Read more about clearfix
.button {
border-radius: 4px;
background-color: #0FA0FF;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 15px;
padding: 10px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
float: right;
display: block;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.containers-fluid {
padding: 20px 50px;
background-color: #000000;
color: white;
}
.clearfix{
clear: both;
}
<button class="button"><span>Proceed to Next Lesson </span>
</button>
<div class="clearfix"></div>
<footer class="containers-fluid text-center">
</footer>
You can use float:right and set the position attribute to relative
Just wrap them both inside a container with display:flex;flex-direction:row; and then apply margin-right:0; to the button.
See the code below
.container{
display:flex;
flex-direction:column;
}
.button {
border-radius: 4px;
background-color: #0FA0FF;
border: none;
color: #FFFFFF;
text-align: center;
font-size: 15px;
padding: 10px;
width: 200px;
transition: all 0.5s;
cursor: pointer;
margin: 5px 0 5px auto;
}
.button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.button span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.button:hover span {
padding-right: 25px;
}
.button:hover span:after {
opacity: 1;
right: 0;
}
.containers-fluid {
padding: 20px 50px;
background-color: #000000;
color: white;
}
<div class="container">
<button class="button"><span>Proceed to Next Lesson </span>
</button>
<footer class="containers-fluid text-center">
</footer>
</div>
I'm doing a search box slide. What I need is that when you click on the magnifying glass, move the slide the "Castilian", text and that it is not fixed text and sarch see box below. It's possible? this is the best I could do ...
My code
try this css. This worked.
#wrap {
margin: 39px 60px;
display: inline-block;
position: relative;
/*float: right;*/
padding: 0;
position: relative;
}
input[type="text"] {
height: 60px;
font-size: 55px;
display: inline-block;
font-family: "Lato";
font-weight: 100;
border: none;
outline: none;
color: #555;
padding: 3px;
padding-right: 60px;
width: 0px;
position: relative;
top: 0;
right: 0;
background: none;
z-index: 3;
transition: width .4s cubic-bezier(0.000, 0.795, 0.000, 1.000);
cursor: pointer;
}
input[type="text"]:focus:hover {
border-bottom: 1px solid #BBB;
}
input[type="text"]:focus form {
width: 700px;
}
input[type="text"]:focus {
width: 700px;
z-index: 1;
border-bottom: 1px solid #BBB;
cursor: text;
}
input[type="submit"] {
height: 67px;
width: 63px;
display: inline-block;
color:red;
/*float: right;*/
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADNQTFRFU1NT9fX1lJSUXl5e1dXVfn5+c3Nz6urqv7+/tLS0iYmJqampn5+fysrK39/faWlp////Vi4ZywAAABF0Uk5T/////////////////////wAlrZliAAABLklEQVR42rSWWRbDIAhFHeOUtN3/ags1zaA4cHrKZ8JFRHwoXkwTvwGP1Qo0bYObAPwiLmbNAHBWFBZlD9j0JxflDViIObNHG/Do8PRHTJk0TezAhv7qloK0JJEBh+F8+U/hopIELOWfiZUCDOZD1RADOQKA75oq4cvVkcT+OdHnqqpQCITWAjnWVgGQUWz12lJuGwGoaWgBKzRVBcCypgUkOAoWgBX/L0CmxN40u6xwcIJ1cOzWYDffp3axsQOyvdkXiH9FKRFwPRHYZUaXMgPLeiW7QhbDRciyLXJaKheCuLbiVoqx1DVRyH26yb0hsuoOFEPsoz+BVE0MRlZNjGZcRQyHYkmMp2hBTIzdkzCTc/pLqOnBrk7/yZdAOq/q5NPBH1f7x7fGP4C3AAMAQrhzX9zhcGsAAAAASUVORK5CYII=) center center no-repeat;
text-indent: -10000px;
border: none;
position: absolute;
top: 0;
right: 0;
z-index: 2;
cursor: pointer;
opacity: 0.4;
cursor: pointer;
transition: opacity .4s ease;
}
input[type="submit"]:hover {
opacity: 0.8;
}
i'm using the css3 search box code below and i want to know how to change the expanding direction of the search box from left to right
wai
#import url(http://fonts.googleapis.com/css?family=Lato:100,300,400,700);
#import url(https://raw.github.com/FortAwesome/Font-Awesome/master/docs/assets/css/font-awesome.min.css);
body {
background: #DDD;
font-size: 15px;
}
#wrap {
margin: 50px 100px;
display: inline-block;
position: relative;
height: 60px;
float: right;
padding: 0;
position: relative;
}
input[type="text"] {
height: 60px;
font-size: 55px;
display: inline-block;
font-family: "Lato";
font-weight: 100;
border: none;
outline: none;
color: #555;
padding: 3px;
padding-right: 60px;
width: 0px;
position: absolute;
top: 0;
right: 0;
background: none;
z-index: 3;
transition: width .4s cubic-bezier(0.000, 0.795, 0.000, 1.000);
cursor: pointer;
}
input[type="text"]:focus:hover {
border-bottom: 1px solid #BBB;
}
input[type="text"]:focus {
width: 700px;
z-index: 1;
border-bottom: 1px solid #BBB;
cursor: text;
}
input[type="submit"] {
height: 67px;
width: 63px;
display: inline-block;
color:red;
float: right;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADNQTFRFU1NT9fX1lJSUXl5e1dXVfn5+c3Nz6urqv7+/tLS0iYmJqampn5+fysrK39/faWlp////Vi4ZywAAABF0Uk5T/////////////////////wAlrZliAAABLklEQVR42rSWWRbDIAhFHeOUtN3/ags1zaA4cHrKZ8JFRHwoXkwTvwGP1Qo0bYObAPwiLmbNAHBWFBZlD9j0JxflDViIObNHG/Do8PRHTJk0TezAhv7qloK0JJEBh+F8+U/hopIELOWfiZUCDOZD1RADOQKA75oq4cvVkcT+OdHnqqpQCITWAjnWVgGQUWz12lJuGwGoaWgBKzRVBcCypgUkOAoWgBX/L0CmxN40u6xwcIJ1cOzWYDffp3axsQOyvdkXiH9FKRFwPRHYZUaXMgPLeiW7QhbDRciyLXJaKheCuLbiVoqx1DVRyH26yb0hsuoOFEPsoz+BVE0MRlZNjGZcRQyHYkmMp2hBTIzdkzCTc/pLqOnBrk7/yZdAOq/q5NPBH1f7x7fGP4C3AAMAQrhzX9zhcGsAAAAASUVORK5CYII=) center center no-repeat;
text-indent: -10000px;
border: none;
position: absolute;
top: 0;
right: 0;
z-index: 2;
cursor: pointer;
opacity: 0.4;
cursor: pointer;
transition: opacity .4s ease;
}
input[type="submit"]:hover {
opacity: 0.8;
}
<div id="wrap">
<form action="" autocomplete="on">
<input id="search" name="search" type="text" placeholder="What're we looking for ?"><input id="search_submit" value="Rechercher" type="submit">
</form>
</div>
Everything seems to work fine except i need it to slide to the right direction
body {
background: #DDD;
font-size: 15px;
}
#wrap {
margin: 50px 100px;
display: inline-block;
position: relative;
height: 60px;
float: left;
padding: 0;
position: relative;
}
input[type="text"] {
height: 60px;
font-size: 55px;
display: inline-block;
font-family: "Lato";
font-weight: 100;
border: none;
outline: none;
color: #555;
padding: 3px;
padding-left: 60px;
width: 0px;
position: absolute;
top: 0;
left: 0;
background: none;
z-index: 3;
transition: width .4s cubic-bezier(0.000, 0.795, 0.000, 1.000);
cursor: pointer;
}
input[type="text"]:focus:hover {
border-bottom: 1px solid #BBB;
}
input[type="text"]:focus {
width: 700px;
z-index: 1;
border-bottom: 1px solid #BBB;
cursor: text;
}
input[type="submit"] {
height: 67px;
width: 63px;
display: inline-block;
color:red;
float: left;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADNQTFRFU1NT9fX1lJSUXl5e1dXVfn5+c3Nz6urqv7+/tLS0iYmJqampn5+fysrK39/faWlp////Vi4ZywAAABF0Uk5T/////////////////////wAlrZliAAABLklEQVR42rSWWRbDIAhFHeOUtN3/ags1zaA4cHrKZ8JFRHwoXkwTvwGP1Qo0bYObAPwiLmbNAHBWFBZlD9j0JxflDViIObNHG/Do8PRHTJk0TezAhv7qloK0JJEBh+F8+U/hopIELOWfiZUCDOZD1RADOQKA75oq4cvVkcT+OdHnqqpQCITWAjnWVgGQUWz12lJuGwGoaWgBKzRVBcCypgUkOAoWgBX/L0CmxN40u6xwcIJ1cOzWYDffp3axsQOyvdkXiH9FKRFwPRHYZUaXMgPLeiW7QhbDRciyLXJaKheCuLbiVoqx1DVRyH26yb0hsuoOFEPsoz+BVE0MRlZNjGZcRQyHYkmMp2hBTIzdkzCTc/pLqOnBrk7/yZdAOq/q5NPBH1f7x7fGP4C3AAMAQrhzX9zhcGsAAAAASUVORK5CYII=) center center no-repeat;
text-indent: -10000px;
border: none;
position: absolute;
top: 0;
left: 0;
z-index: 2;
cursor: pointer;
opacity: 0.4;
cursor: pointer;
transition: opacity .4s ease;
}
input[type="submit"]:hover {
opacity: 0.8;
}
<div id="wrap">
<form action="" autocomplete="on">
<input id="search" name="search" type="text" placeholder="What're we looking for ?"><input id="search_submit" value="Rechercher" type="submit">
</form>
</div>
like this
body {
background: #DDD;
font-size: 15px;
}
#wrap {
margin: 50px 100px;
display: inline-block;
position: relative;
height: 60px;
float: right;
padding: 0;
position: relative;
}
input[type="text"] {
height: 60px;
font-size: 30px;
display: block;
font-family: "Lato";
font-weight: 200;
outline: none;
border:none;
color: black;
padding-right: 400px;
width: 100%;
position: absolute;
float: left;
top: 0;
right: 0;
background: none;
z-index: 3;
transition: all .4s ;
cursor: pointer;
opacity:0;
}
input[type="text"]:focus:hover {
border-bottom: 1px solid #BBB;
}
input[type="text"]:focus {
padding-right: 0px;
opacity:1;
border:normal;
z-index: 1;
border-bottom: 1px solid #BBB;
cursor: text;
}
input[type="submit"] {
height: 67px;
width: 63px;
display: inline-block;
color:red;
float: right;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADNQTFRFU1NT9fX1lJSUXl5e1dXVfn5+c3Nz6urqv7+/tLS0iYmJqampn5+fysrK39/faWlp////Vi4ZywAAABF0Uk5T/////////////////////wAlrZliAAABLklEQVR42rSWWRbDIAhFHeOUtN3/ags1zaA4cHrKZ8JFRHwoXkwTvwGP1Qo0bYObAPwiLmbNAHBWFBZlD9j0JxflDViIObNHG/Do8PRHTJk0TezAhv7qloK0JJEBh+F8+U/hopIELOWfiZUCDOZD1RADOQKA75oq4cvVkcT+OdHnqqpQCITWAjnWVgGQUWz12lJuGwGoaWgBKzRVBcCypgUkOAoWgBX/L0CmxN40u6xwcIJ1cOzWYDffp3axsQOyvdkXiH9FKRFwPRHYZUaXMgPLeiW7QhbDRciyLXJaKheCuLbiVoqx1DVRyH26yb0hsuoOFEPsoz+BVE0MRlZNjGZcRQyHYkmMp2hBTIzdkzCTc/pLqOnBrk7/yZdAOq/q5NPBH1f7x7fGP4C3AAMAQrhzX9zhcGsAAAAASUVORK5CYII=) center center no-repeat;
text-indent: -10000px;
border: none;
position: absolute;
top: 0;
right: 0;
z-index: 2;
cursor: pointer;
opacity: 0.4;
cursor: pointer;
transition: opacity .4s ease;
}
input[type="submit"]:hover {
opacity: 0.8;
}
form {
width: 460px;
overflow:hidden;
}
<div id="wrap">
<form action="" autocomplete="on" onclick='return false'>
<input id="search" name="search" type="text" placeholder="What're we looking for ?" ><input id="search_submit" value="Rechercher" type="submit">
</form>
</div>