I have been created simple search form, using by google.
Here is my jsfiddle link: http://jsfiddle.net/njs6d489/
In that, search icon right side right?
But i need icon looking left side and placeholder also need to place left side.
I explained in this image http://s22.postimg.org/ype712rcx/Untitled_1.png
May i know, how can i do this. Is there possible to do this?
Thanks in advance.
body {
background: #fff;
color: #666;
font: 90%/180% Arial, Helvetica, sans-serif;
width: 800px;
max-width: 96%;
margin: 0 auto;
}
a {
color: #69C;
text-decoration: none;
}
a:hover {
color: #F60;
}
input {
outline: none;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(http://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
/* Demo 2 */
#demo-2 input[type=search] {
width: 15px;
padding-left: 10px;
color: transparent;
cursor: pointer;
}
#demo-2 input[type=search]:hover {
background-color: #fff;
}
#demo-2 input[type=search]:focus {
width: 130px;
padding-left: 32px;
color: #000;
background-color: #fff;
cursor: auto;
}
#demo-2 input:-moz-placeholder {
color: transparent;
}
#demo-2 input::-webkit-input-placeholder {
color: transparent;
}
Are you expecting like this: Demo
Updated Demo
I changed the search icon's background position at Normal state as 50% and on focus as 90%.
Here I included only the css which I changed.
CSS:
input[type=search] {
background: #ededed url(http://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 50% center;
float:right;
}
input[type=search]:focus {
background: #ededed url(http://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 90% center;
}
Related
I've a search box created in CSS. When I click its icon, it displays input bar. It works perfectly. The only problem is when I click it, it opens input bar in right side area of search icon. I wanted to open it to left side of the icon. How I can do that?
Here's the code I am using:
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%
}
input::-webkit-search-cancel-button,
input::-webkit-search-decoration {
display: none;
}
input[type=search] {
background: var(--search-color);
border: solid 1px var(--bg-color);
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66cc75;
-webkit-box-shadow: 0 0 5px rgba(109, 207, 246, .5);
-moz-box-shadow: 0 0 5px rgba(109, 207, 246, .5);
box-shadow: 0 0 5px rgba(109, 207, 246, .5)
}
#sv2 input[type=search] {
width: 24px;
padding-left: 10px;
color: transparent;
cursor: pointer;
outline: 0
}
#sv2 input[type=search]:hover {
background-color: var(--bg-color)
}
#sv2 input[type=search]:focus {
width: 160px;
padding-left: 32px;
color: var(--font-color);
background-color: var(--bg-color);
cursor: auto
}
#sv2 input:-moz-placeholder {
color: transparent
}
#sv2 input::-webkit-input-placeholder {
color: transparent
}
<form method="get" action="https://www.example.com/" id="sv2">
<input name="s" id="s" size="30" type="search" placeholder="Search example.com">
</form>
Thanks for your help!
To change the size from right to left, you have to move the whole page with direction: rtl; Adjust it.
body {
background: #fff;
color: #666;
font: 90%/180% Arial, Helvetica, sans-serif;
width: 800px;
max-width: 96%;
margin: 0 auto;
direction: rtl;
}
a {
color: #69C;
text-decoration: none;
}
a:hover {
color: #F60;
}
h1 {
font: 1.7em;
line-height: 110%;
color: #000;
}
p {
margin: 0 0 20px;
}
input {
outline: none;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109, 207, 246, .5);
-moz-box-shadow: 0 0 5px rgba(109, 207, 246, .5);
box-shadow: 0 0 5px rgba(109, 207, 246, .5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
/* Demo 2 */
#demo-2 input[type=search] {
width: 15px;
padding-left: 10px;
color: transparent;
cursor: pointer;
}
#demo-2 input[type=search]:hover {
background-color: #fff;
}
#demo-2 input[type=search]:focus {
width: 130px;
padding-left: 32px;
color: #000;
background-color: #fff;
cursor: auto;
}
#demo-2 input:-moz-placeholder {
color: transparent;
}
#demo-2 input::-webkit-input-placeholder {
color: transparent;
}
<h1>Expandable Search Form</h1>
<p>Pen by Prinzadi</p>
<h3>Demo 1</h3>
<form>
<input type="search" placeholder="Search">
</form>
<h3>Demo 2</h3>
<form id="demo-2">
<input type="search" placeholder="Search">
</form>
Or adjust it by setting the input with the position: absolute; and setting the right:0;.
body {
background: #fff;
color: #666;
font: 90%/180% Arial, Helvetica, sans-serif;
width: 100%;
max-width: 96%;
margin: 0 auto;
}
a {
color: #69C;
text-decoration: none;
}
a:hover {
color: #F60;
}
h1 {
font: 1.7em;
line-height: 110%;
color: #000;
}
p {
margin: 0 0 20px;
}
input {
outline: none;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109, 207, 246, .5);
-moz-box-shadow: 0 0 5px rgba(109, 207, 246, .5);
box-shadow: 0 0 5px rgba(109, 207, 246, .5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
#myForm {
position: relative;
width: 160px;
}
#myForm input[type=search] {
position: absolute;
right: 0;
}
<h1>Expandable Search Form</h1>
<p>Pen by Prinzadi</p>
<h3>Demo 1</h3>
<form id="myForm">
<input type="search" placeholder="Search">
</form>
I have a button that is common for every component , so instead of styling the components individually i decided to put these button styling in style.css .
But it dosent work all other properties like background and p tag works but not for this button is it beacause of the webkit i am using for this button.
I works when i put it in individual components.
CSS
input {
outline: none;
float: right;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
height:15px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
input {
outline: none;
float: right;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
height:15px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
TEMPLATE
<div class="col l3 offset-l9">
<input type="search" placeholder="Search" #input>
</div>
This is how it should look
This is how it looking now
I tried using view Encapsulation but i dnt think that makes any diffrence as that is for parent child styling and these are indivdual components
Please help-
to use global styles and disable view css encapsulation
in involved components, add :
#Component({
..
encapsulation: ViewEncapsulation.None,
..
}
Well its working when i tried it
input {
outline: none;
float: right;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
height:15px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
input {
outline: none;
float: right;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
height:15px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
<div class="col l3 offset-l9">
<input type="search" placeholder="Search" #input>
</div>
[https://jsfiddle.net/xr9fvLgd/]
You can apply the Global Style in the '.angular-cli.json' file and applicable to whole project.
Open your code folder in Visual Studio Code and look for the '.angular-cli.json' file, under the 'apps' array object object, add styles array object.
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
If I leave out the 5 background-image gradient lines (below), button color successfully changes on hover. But if I leave them in, shadow continues to work on hover but not the background-color. Any ideas?
.buttonlink:link, .buttonlink:visited {
background-color: #557fff; /* For browsers that do not support gradients */
background-image: -moz-linear-gradient(top,#08c,#04c); /* Firefox 3.6-15*/
background-image: -webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));
background-image: -webkit-linear-gradient(top,#08c,#04c); /* For Chrome 25 and Safari 6, iOS 6.1, Android 4.3 */
background-image: -o-linear-gradient(top,#08c,#04c); /* Opera 11.1-12 */
background-image: linear-gradient(to bottom,#08c,#04c); /* Standard, must be last */
color: white;
width:125px;
height:25px;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
display: inline-block;
border: 2px solid #0055ff;
border-radius: 5px;
}
.buttonlink:hover, .buttonlink:active {
background-color: #E2AD27;
box-shadow: 5px 5px 5px #888888;
}
MassDebates kindly created an example that works. I also created an example in jsfiddle and that works too. Is something else in my css file overriding it? Here is the full css:
body {
height: 100%;
line-height: 25px;
font-size: 13px;
}
.infoReset {
border-width: 1px;
border-style: solid;
border-color: #858585;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: #FFFFFF;
/**behavior: url(PIE.htc);**/
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-pie-poll: true;
position: relative;
width: 250px;
}
.auditLogSearch {
border-width: 1px;
border-style: solid;
border-color: #858585;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: #FFFFFF;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-pie-poll: true;
position: relative;
width: 100px;
}
#FromDatePicker, #ToDatePicker {
width: 75px;
}
input[type="text"]:FOCUS,input[type="password"]:FOCUS,select:FOCUS,textarea:FOCUS {
border: 1px solid #52A8EC !important;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px
rgba(82, 168, 236, 0.6);
outline: 0 none;
/**behavior: url(PIE.htc);**/
-pie-poll: true;
position: relative;
}
input[textarea] {
resize: none;
}
#page-wrapper {
width: 800px;
min-width: 800px;
min-height: 500px;
clear: both;
margin: 0 auto;
}
#audit-wrapper {
width: 1000px;
min-width: 1000px;
min-height: 500px;
clear: both;
margin: 0 auto;
}
hr {
border: 2px solid #000;
}
.hidden {
display: none;
}
#auditTable {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 70%;
}
#auditTable td, #auditTable th {
border: 1px solid #ddd;
text-align: left;
padding: 3px;
}
#auditTable tr:nth-child(even){background-color: #f2f2f2}
#auditTable tr:hover {background-color: #ddd;}
#auditTable th {
padding-top: 8px;
padding-bottom: 8px;
background-color: #4CAF50;
color: white;
}
.buttonlink:link, .buttonlink:visited {
background-color: #557fff; /* For browsers that do not support gradients */
background-image: -moz-linear-gradient(top,#08c,#04c); /* Firefox 3.6-15*/
background-image: -webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));
background-image: -webkit-linear-gradient(top,#08c,#04c); /* For Chrome 25 and Safari 6, iOS 6.1, Android 4.3 */
background-image: -o-linear-gradient(top,#08c,#04c); /* Opera 11.1-12 */
background-image: linear-gradient(to bottom,#08c,#04c); /* Standard, must be last */
color: white;
width:125px;
height:25px;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
display: inline-block;
border: 2px solid #0055ff;
border-radius: 5px;
}
.buttonlink:hover, .buttonlink:active {
background-image: -moz-none;
background-image: -webkit-none;
background-image: -webkit-none;
background-image: -o-none;
background-image:none;
background-color: #E2AD27;
box-shadow: 5px 5px 5px #888888;
}
h2 {
color: #5F489D;
}
Your CSS has no rules to override the previously-set background-image styles. Please consider the following:
.buttonlink:hover, .buttonlink:active {
background-image: -moz-none;
background-image: -webkit-none;
background-image: -webkit-none;
background-image: -o-none;
background-image:none;
background-color: #E2AD27;
box-shadow: 5px 5px 5px #888888;
}
Here's a demo to show you a live example:
http://codepen.io/anon/pen/kXZwdX
This is the simplest, less amount of lines, and easiest solution to your problem:
.buttonlink:hover, .buttonlink:active {
background: #E2AD27;
}
I have a search field with a search icon in the background. Here's the CSS:
input[type=search] {
outline: none;
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
background: #ededed url('$http://www.$domain/images/search-icon.png') no-repeat right 5px top 5px;
padding-left: 8px;
padding-right: 24px;
border: solid 1px #ccc;
width: 122px;
font-size:16px;
font-family: \"Lato\";
font-weight: 300;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 230px;
background-color: #fff;
border-color: #7486BA;
-webkit-box-shadow: 0 0 5px #7486BA;
-moz-box-shadow: 0 0 5px #7486BA;
box-shadow: 0 0 5px #7486BA;
}
#media screen and (max-width: 800px) {
input[type=search]:focus {
width: 122px;
}
}
input[type=search]:-moz-placeholder {
color: #DEDEDE;
}
input[type=search]::-webkit-input-placeholder {
color: #DEDEDE;
}
and here's the HTML:
<form id=\"search_form\" method=\"GET\" action=\"$http://www.$domain/\">
<input type=\"search\" id=\"search\" name=\"search\" placeholder=\"$search_placeholder\" class=\"awesomplete\" autocomplete=\"off\">
</form>
The form can only be submit by pressing enter button. What would be the easiest way to make the search icon clickable ?
I tried making a 30x30 anchor with relative positionning on top of the search icon but it wasn't working well
I want to show a p tag or legend tag or any html text like button. But how is it possible? I have tried with css but not working well.
I want to show it like button.
<p class="button" >Submit</p>
or
<a class="button" >Submit</a>
or
<legend class="button" >Submit</legend>
Now need the button class.
Just apply css styles and cursor: pointer; to it to make it appear that it's a button
.button{
display: inline-block;
background: #000;
border-radius: 4px;
font-family: "arial-black";
font-size: 14px;
color: #FFF;
padding: 8px 12px;
cursor: pointer;
}
JSFIDDLE
It is simple with css.
<p class='btn'> Button 1 </p>
And Your CSS
.btn{
float:left;
width:auto;
height:30px;
display:block;
border:1px solid #ff6600;
background:#00ff00;
color:#000;
line-height:30px;
text-align:center;
padding:0 20px;
border-radius:3px;
}
.btn:hover{
cursor:pointer;
}
jsfiddle : http://jsfiddle.net/ob67xnw4/1/
Try This.
Here is the Working FIDDLE
CSS
.button {
width: 75px;
background: #d2d2d2;
text-align: center;
float: left;
color: #000;
line-height: 32px;
text-decoration: none;
}
.button: hover{
width: 75px;
background: #0e567f;
color: #fff;
text-align: center;
float: left;
line-height: 32px;
text-decoration: none;
}
<p class='button'> Submit </p>
.button{
background: -webkit-linear-gradient(top, #CCB5B6 20%, #274936 70%);
width: 100px;
height: 40px;
font-family: sans-serif;
font-size: 25px;
text-align: center;
line-height: 40px;
color: #96F256;
border-radius: 10px;
box-shadow: 0 2px 5px 3px black;
cursor: pointer;
}
.button:hover{
color: white;
}
OUTPUT
I think you should use this code and it is working well. You can change Color according to you.
Live Demo
HTML Code:
<input class="round-button-circle" type="submit" value="Submit"/>
CSS Code:
.round-button-circle {
width: 150px;
height:50px;
border-radius: 10px;
border:2px solid #cfdcec;
overflow:hidden;
font-weight: 15px;
background: #4679BD;
box-shadow: 0 0 3px gold;
}
.round-button-circle:hover {
background:#30588e;
}
Result:
Had just got what did I want.
DEMO JSFIDDLE
.button {
display: inline-block;
outline: none;
cursor: pointer;
border: solid 1px #da7c0c;
background: #478dad;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 2em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .3em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.button:hover {
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
}
.button:active {
position: relative;
top: 1px;
}