I am attempting to create a sliding search bar/box that moves on transition when you select the magnifying glass. The issue it that there is only a small space in which you are able to select the magnifying glass to open the search bar. Then, when the search bar has been opened, the space to close it moves back (to the right of the magnifying glass) about 5 px. I would like for the selectable area to be on the magnifying glass the entire time.
This is the HTML
<div class="wrap">
<form action="" autocomplete="on">
<input id="search" name="search" type="text" placeholder="Search by Address, Agent or Client..."/>
<span class="fa fa-search"></span>
</form>
This is the CSS
body {
background: #005DC1;
font-size: 15px;
}
.wrap {
position: relative;
right: 50px;
height: 22px;
float: right;
}
input[type="text"] {
height: 20px;
width: 0px;
font-size: 12px;
font-family: helvetica;
border: none;
outline: none;
color: rgba(255, 255, 255, 0.8);
padding: 3px;
position: absolute;
top: 0;
right: 0;
background: none;
z-index: 1;
transition: width .4s cubic-bezier(0.000, 0.795, 0.000, 1.000);
cursor: pointer;
}
input[type="text"]:focus:hover {
border-bottom: 1px solid #fff;
}
input[type="text"]:focus {
width: 250px;
z-index: 1;
border-bottom: 1px solid #fff;
cursor: text;
}
.wrap span {
color: rgba(255, 255, 255, 0.8);
z-index: 5000;
cursor: pointer;
right: 3px;
height: 20px;
width: 25px;
}
Here is my current CodePen.
Here is the original Codepen I am attempting to mimic with my own design.
I think you just need to add padding-right to your input, see this CodePen
Related
Hi I'm trying to make a simple text pop-up button using just html and CSS. I looked at a bunch of examples but most of them use JavaScript in some way so I cant use them. found some that is pure CSS but when I tried them, they all do this weird thing where closing the pop-up brings me to top of page. Any help is appreciated. Thanks
jsfiddle: http://jsfiddle.net/hjrudc5n/
This is my HTML
```
<div class="box"><a class="button" href="#popup1">Show Overlay</a></div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Title</h2>
<a class="close" href="#">×</a>
<div class="content">Content</div>
</div>
</div>
</div>
and this is my CSS
/*pop up overlay */
.box {
width: 20%;
margin: 0 auto;
background: rgba(255, 255, 255, 0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid blue;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: blue;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
Check this out:
http://jsfiddle.net/aj43psdw/13/
The problem with your code was that using "#" as an href will always take you to the top of the page, no matter what. Also, makes thing hard to control.
What you can do. is work with labels and checkboxes, and control the "state" of things via that.
Like this:
[name="popup"]{
width:0;
height:0;
overflow:hidden;
position:relative;
z-index:-1;
pointer-events:none;
}
[name="popup"]:checked ~ .overlay{
visibility: visible;
opacity: 1;
}
In the fiddle I linked you, clicking the button will check the checkbox, that we'll show via css. the X button will do the same, unchecking it.
It was because of href="#" of the anchor tag you were using, which led to going to top of page on closing the popup.
A workaround is to use <input type="checkbox" /> (so that you can use :checked selector) along with <label>(so that you can still interact with checkbox after hiding it), to hide, and unhide the popup.
/*pop up overlay */
.box {
width: 20%;
margin: 0 auto;
background: rgba(255, 255, 255, 0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid blue;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: blue;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
#pop:checked + .overlay {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#pop{
display: none; /*Hide the checkbox*/
}
<div class="box"><label class="button" for="pop">Show Overlay</label></div>
<input type="checkbox" id="pop" />
<div id="popup1" class="overlay">
<div class="popup">
<h2>Title</h2>
<label class="close" for="pop">×</label>
<div class="content">Content</div>
</div>
</div>
I am making a section which contains price info section and order now button.
Here, there is a wrapper border class that make the border for the entire section.
Scenario:
In this case consider that button is disabled with opacity and hence it looks like this now.
.border {
border: 4px solid rgb(195, 0, 38);
border-bottom: transparent;
}
.info-card {
padding-bottom: 20px;
}
button {
background-color: rgb(195, 0, 38);
opacity: 0.5;
border-radius: 10px;
color: #fff;
padding: 5px;
}
.order-button {
margin-top: -1.5rem;
}
<div class="border">
<div class="info-card">
<h1> Info Section </h1>
</div>
</div>
<div class="order-button">
<button>
Order Now
</button>
</div>
But the requirement is that the border line should go behind the button (and not above the button) as like the below image.
Expected Result:
Note: Here opacity is included to make the button look like disabled.
Also the color given above varies and so please don't include any other addition of colors.
Tried with increasing z-index of button but that doesn't work in this case.
Try this:
button::after {
position: absolute;
content: "";
width: 100%;
height: 100%;
left: 0;
border-radius: 20px;
background-color: rgba(197, 218, 227,.5);
top: 0;
z-index: 9999;
}
button {
background-color: rgb(197, 218, 227);
border-radius: 37px;
color: #fff;
padding: 12px 5px;
display: block;
width: calc(100% + 4px);
margin-left: -2px;
margin-right: -2px;
border: unset;
cursor: pointer;
position: relative;
}
I am pretty new in web development and I am trying to make an affect on a left button that when you hover over it there is a smaller arrow appearing and the whole button expand into the left side of the screen, but for some reason it doesn't look as smooth as I want it too look and I can't find a way to make it that way, can someone help me? :)
PS:Rmain is the arrow always displayed on the button, Rside is the arrow that appearing when you hover over the button.
html:
<button class="right">
<span class="Rmain"></span>
<span class="Rside"></span>
</button>
css:
.left {
background-color: rgba(255, 255, 255, 0.863);
border: 4px solid rgb(60, 57, 238);
color: rgb(0, 0, 0);
padding: 145px 10px;
margin: 50px;
width: 55px;
text-align: right;
border-radius: 10%;
position: absolute;
transition: 0.6s;
}
.left:hover {
box-shadow: 5px 12px 16px 0 rgba(0, 0, 0, 0.4);
background-color: rgb(60, 57, 238);
color: rgb(255, 255, 255);
opacity: 75%;
cursor: pointer;
border-left-width: 95px;
transition: 0.6s;
}
.Lmain {
position: absolute;
height: 0px;
width: 0px;
top: 40%;
right: 86%;
font-size: 40px;
}
.Lmain::after {
content: '\290C';
}
.Lside {
position: absolute;
color: white;
height: 0px;
opacity: 0;
top: 40%;
right: 58%;
font-size: 39px;
transition: 0.4s;
}
.Lside::after {
content: '\2039';
}
.left:hover .Lside {
right: 72%;
transition: 1s;
opacity: 1;
}
button:focus {
outline: 0;
}
I'm not sure if this is what you're looking for, but it looks better this way:
add border-right-width:20px; into .left:hover section of css
Im trying to add a linear effect on my input button. When the user hovers on the button, I want the bottom border line to start from center, and then go to right and left at the same time. So the line spreads out from center to the corners when the user hovers over it.
I managed to add a hover line, but it does not work as I want. I have looked around and I can only find questions regarding headings or tabs, not buttons.
#btn {
margin: 10px;
padding: 20px;
width: 470px;
height: 50px;
border: 2px solid #f7f7f7;
text-align: center;
text-transform: uppercase;
position: relative;
}
#btn:hover {
cursor: pointer;
border-bottom: 2px solid red;
transition: 0.3s;
}
<input id="btn" type="submit" name="" value="Click">
You cannot use pseudo-element since it's an input tag so you can try this solution with linear-gradient as background:
#btn {
margin: 10px;
padding: 20px;
width: 470px;
height: 50px;
border: 2px solid #f7f7f7;
text-align: center;
text-transform: uppercase;
cursor: pointer;
background:
linear-gradient(red, red) bottom / 0% 2px no-repeat
#ccc;
transition: 1s;
}
#btn:hover {
background-size: 100% 2px;
}
<input id="btn" type="submit" name="" value="Click">
I started learning playing with HTML and CSS.
I have something in mind, and I know this is possible with the help of JavaScript.
But I want to know if its possible just with CSS.
here is my image:
<img id="picturegoeshere" src="picture.png" width="100" height="90">
here is the CSS part:
.picturegoeshere:hover
{
transform:scale(2,2);
transform-origin:0 0;
}
Is their a way to click the image, then pop up ? "hover" works but I want the 'popup' to stay. Because after this part works, but I want to add information about the image (hyperlinks or something else).
I found .picturegoeshere:active but that only makes it bigger while the mouse click is still down..
I'm sure many people have asked the same question, but I cant seem to find their questions, I must be searching the wrong questions because I don't know the terminology for CSS yet I guess?
No did not like that you are doing ...
If you want with this css only then do this ...
as you know you can use focus instead of click it !right! (both mean same).
just create that pop up menu on screen and hide it and then use css like this
#image1:focus #popupmenu{
display:initial;
}
what you need :::
1. Just show image on the screen first.
Show the popup menu by using position:fixed;
And then hide your menu.
After hide use
#image1:focus #popupmenu{ display:initial; }
This create a popup menu for you.
Use same method for close button and for thumb changing
<a href="#openModal">
<img src="http://www.cssscript.com/wp-content/themes/iconic-one/img/twitter.png" alt="Follow us on Twitter"></a>
<div id="openModal" class="modalDialog">
<div>
X
<h2>Modal Box</h2>
<p>This is a sample modal box that can be created using the powers of CSS3.</p>
<p>You could do a lot of things here like have a pop-up ad that shows when your website loads, or create a login/register form for users.</p>
</div>
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity:1;
pointer-events: auto;
}
.modalDialog > div {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}
.close {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.close:hover {
background: #00d9ff;
}
I think you are looking for this:
body {
font-family: Arial, sans-serif;
background: url(4.jpg);
background-size: cover;
}
h1 {
text-align: center;
font-family: Tahoma, Arial, sans-serif;
color: orange;
margin: 100px 0;
}
.box {
width: 20%;
margin: 0 auto;
background: rgba(255,255,255,0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid orange;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
background: orange;
}
.button:hover {
background: orange;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
<h1>Popup/Modal Windows without JavaScript</h1>
<div class="box">
<a class="button" href="#popup1">Let me Pop up</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
Thank to pop me out of that button, but now i'm done so you can close this window.
</div>
</div>
</div>
Check this site:-
http://www.sevensignature.com/blog/code/pure-css-popup-without-javascript
http://meyerweb.com/eric/css/edge/popups/demo.html