css padding the placeholder text inside the text field - css

I am trying to pad the bottom area for the placeholder text, because it is too close to the line. but i am not sure what property is going to work. Here is my css. And also, another problem is that when I open it on firefox, the magnifying icon is about 1 pixel higher than the line. It looks fine on chrome. Does anybody know?
Thanks.
.search_input{
font-family: Helvetica;
font-size:14px;
border:1px solid #000000;
border-top:1px;
border-right: -0px;
border-left: 0px;
margin-left: 3px;
margin-right: -23px;
margin-top: 6px;
width: 150px;
box-sizing: border-box;
}
#tfnewsearch input:focus {
outline: 0;
background: #fff;
-moz-box-shadow: 0 0 2px rgba(0,0,0,.8) inset;
-webkit-box-shadow: 0 0 2px rgba(0,0,0,.8) inset;
box-shadow: 0 0 2px rgba(0,0,0,.8) inset;
}
#tfnewsearch input::-webkit-input-placeholder {
color: #999;
font-size: 17px;
padding-bottom:3px;
height: 19px;
}
#tfnewsearch input:-moz-placeholder {
color: #999;
font-size: 17px;
padding-bottom:3px;
}
#tfnewsearch input:-ms-input-placeholder {
color: #999;
font-size: 17px;
padding-bottom:3px;
}
.t_button {
outline: none; cursor: pointer;margin-bottom: -5px; margin-left: 22px;margin-right: 1px; border: solid 1px #000000; border-top:0px; border-left: 1px; border-right: 1px;
}
<form id="tfnewsearch" method="get" action="index.php">
<input type="text" class="search_input" name="q" size="17" maxlength="120" placeholder="Search" required><img src="imgs/icon_search.gif" value="search" class="t_button">
</form>

try to use padding to .search_input
.search_input{
font-family: Helvetica;
font-size:14px;
border:1px solid #000000;
border-top:1px;
border-right: -0px;
border-left: 0px;
margin-left: 3px;
margin-right: -23px;
margin-top: 6px;
width: 150px;
box-sizing: border-box;
padding-bottom:5px;
}
http://jsfiddle.net/yZXSJ/

Related

Checkbox: can't check checkbox in Safari

i've created a contact form with Contact Form 7 Plugin (Wordpress) checkbox but i can't chech them in Safari.
How can i solve it? http://www.r90.ch/contact-form/
CSS:
.myinput[type="checkbox"]{
width: 11px !important;
height: 11px !important;
border: 1px solid #808080 !important; }
Try this code for checkbox style
<style>
.regular-checkbox {
-webkit-appearance: none;
background-color: #fafafa;
border: 1px solid #cacece;
box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05);
padding: 9px;
border-radius: 3px;
display: inline-block;
position: relative;
}
.regular-checkbox:checked:after {
content: '\2714';
font-size: 14px;
position: absolute;
top: 0px;
left: 3px;
color: #99a1a7;
}
</style>
<input type="checkbox" id="checkbox-1-1" class="regular-checkbox" />

Block elements inside button element acts unexpected

I am trying to create a button that shows a loading spinner when waiting for a response. But there is some weird things going on which I do not understand at all.
I have the following HTML with a bunch of CSS:
<button type="submit" disabled="true" class="btn btn-blue btn-loading">
<div class="btn-loading-text">Update profile</div>
<div class="btn-loading-spinner"></div>
</button>
If you comment out the spinner element, then the "Update profile" aligns itself in the center even tho I did not ask it to.
* {
box-sizing: border-box;
}
.btn-loading {
border-radius: 2px;
font-size: 13px;
font-family: arial, helvetica, sans-serif;
text-decoration: none;
display: inline-block;
font-weight: bold;
outline: 0;
background: #f5f5f5 !important;
border: 1px solid #ddd !important;
color: #aaa !important;
cursor: default !important;
overflow: hidden;
height: 40px;
}
.btn-loading-text {
float: left;
margin: 0px 15px 0px 15px;
}
.btn-loading-spinner {
float: left;
height: 25px;
width: 25px;
margin: 7px 15px 6px -5px;
position: relative;
animation: rotation .9s infinite linear;
border-left: 3px solid #ddd;
border-right: 3px solid #ddd;
border-bottom: 3px solid #ddd;
border-top: 3px solid #aaa;
border-radius: 100%;
}
#keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
<button type="submit" disabled="true" class="btn-loading">
<div class="btn-loading-text">Update profile</div>
<!--<div class="btn-loading-spinner"></div>-->
</button>
But when the spinner element is there it suddently goes to the top. I have no idea what's going on.
* {
box-sizing: border-box;
}
.btn-loading {
border-radius: 2px;
font-size: 13px;
font-family: arial, helvetica, sans-serif;
text-decoration: none;
display: inline-block;
font-weight: bold;
outline: 0;
background: #f5f5f5 !important;
border: 1px solid #ddd !important;
color: #aaa !important;
cursor: default !important;
overflow: hidden;
height: 40px;
}
.btn-loading-text {
float: left;
margin: 0px 15px 0px 15px;
}
.btn-loading-spinner {
float: left;
height: 25px;
width: 25px;
margin: 7px 15px 6px -5px;
position: relative;
animation: rotation .9s infinite linear;
border-left: 3px solid #ddd;
border-right: 3px solid #ddd;
border-bottom: 3px solid #ddd;
border-top: 3px solid #aaa;
border-radius: 100%;
}
#keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
<button type="submit" disabled="true" class="btn-loading">
<div class="btn-loading-text">Update profile</div>
<div class="btn-loading-spinner"></div>
</button>
The content of a button element are vertically aligned to the middle.
When you only have .btn-loading-text, that element is 16px tall, and the button is 38px tall, so .btn-loading-text is aligned to the middle.
However, when you also include .btn-loading-spinner, which is 38px tall (including borders and margins), the content of the button is as tall as the tallest of the elements, so 38px. So the alignment to the middle is not noticeable.
If you want to align each element to the middle, instead of aligning the content as a whole, you can use display: inline-block instead of float: left, and vertical-align: middle.
.btn-loading-text, .btn-loading-spinner {
float: none; /* Initial value */
display: inline-block;
vertical-align: middle;
}
* {
box-sizing: border-box;
}
.btn-loading {
border-radius: 2px;
font-size: 13px;
font-family: arial, helvetica, sans-serif;
text-decoration: none;
display: inline-block;
font-weight: bold;
outline: 0;
background: #f5f5f5 !important;
border: 1px solid #ddd !important;
color: #aaa !important;
cursor: default !important;
overflow: hidden;
height: 40px;
}
.btn-loading-text, .btn-loading-spinner {
display: inline-block;
vertical-align: middle;
}
.btn-loading-text {
margin: 0px 15px 0px 15px;
}
.btn-loading-spinner {
height: 25px;
width: 25px;
margin: 7px 15px 6px -5px;
position: relative;
animation: rotation .9s infinite linear;
border-left: 3px solid #ddd;
border-right: 3px solid #ddd;
border-bottom: 3px solid #ddd;
border-top: 3px solid #aaa;
border-radius: 100%;
}
#keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
<button type="submit" disabled="true" class="btn-loading">
<div class="btn-loading-text">Update profile</div>
<div class="btn-loading-spinner"></div>
</button>

How can I make a button change its background color when pressed down?

I am using AngularJS and I wonder if there are any features that can help me. I have the following button CSS:
button {
background-color: #button-background-color;
border: 1px solid #button-border;
background-color: #ccc;
border: 1px solid #999;
color: #button-color;
background: #e6e6e6;
background-image: -moz-linear-gradient(top,#fff,#d9d9d9);
background-image: -webkit-linear-gradient(top,#fff,#d9d9d9);
background-image: -o-linear-gradient(top,#fff,#d9d9d9);
background-image: -ms-linear-gradient(top,#fff,#d9d9d9);
background-image: linear-gradient(top,#fff,#d9d9d9);
border: 1px solid #ccc;
border-top-color: #ccc;
border-bottom-color: #a2a2a2;
border-radius: 4px;
text-shadow: 0 1px 0 rgba(255,255,255,1);
box-shadow: 0 1px 1px rgba(0,0,0,.1),inset 0 1px 0 rgba(255,255,255,.2);
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
display: inline-block;
line-height: 18px;
line-height: 1.8rem;
font-size: 14px;
font-size: 1.4rem;
cursor: pointer;
color: #474747;
padding: 4px 10px 3px 10px;
font-family: arial,sans-serif;
vertical-align: middle;
}
This looks good but I would like to have an effect that appears when I hover over and click on a button without yet releasing the click.
Is there any way that I can catch this with angular and have the class changed for the period when I am holding down the button?
Please note that I am looking for a CSS only or a CSS/AngularJS solution. I am not using jQuery.
Thanks
http://www.w3schools.com/cssref/sel_hover.asp
http://www.w3schools.com/cssref/sel_active.asp
button:hover button:active
button {
background-color: #button-background-color;
border: 1px solid #button-border;
background-color: #ccc;
border: 1px solid #999;
color: #button-color;
background: #e6e6e6;
background-image: -moz-linear-gradient(top,#fff,#d9d9d9);
background-image: -webkit-linear-gradient(top,#fff,#d9d9d9);
background-image: -o-linear-gradient(top,#fff,#d9d9d9);
background-image: -ms-linear-gradient(top,#fff,#d9d9d9);
background-image: linear-gradient(top,#fff,#d9d9d9);
border: 1px solid #ccc;
border-top-color: #ccc;
border-bottom-color: #a2a2a2;
border-radius: 4px;
text-shadow: 0 1px 0 rgba(255,255,255,1);
box-shadow: 0 1px 1px rgba(0,0,0,.1),inset 0 1px 0 rgba(255,255,255,.2);
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
display: inline-block;
line-height: 18px;
line-height: 1.8rem;
font-size: 14px;
font-size: 1.4rem;
cursor: pointer;
color: #474747;
padding: 4px 10px 3px 10px;
font-family: arial,sans-serif;
vertical-align: middle;
}
button:hover
{
background: red;
}
button:active
{
background: green;
}
<button>button</button>
you can put the following css:
button:active{
background-color: red;
}
for more information: http://www.w3schools.com/cssref/sel_active.asp

How do I change the alignment of my search box?

How can I change the position of this search box to right-top and align it?
HTML
<form class="form-wrapper cf">
<input type="text" placeholder="Search here..." required>
<button type="submit">Go</button>
</form>
CSS
.cf:before, .cf:after{
content:"";
display:table;
}
.cf:after{
clear:both;
}
.cf{
zoom:1;
}
/* Form wrapper styling */
.form-wrapper {
width: 450px;
padding: 15px;
margin: 600px auto 50px auto;
background: #444;
background: rgba(0,0,0,.2);
border-radius: 10px;
box-shadow: 0 1px 1px rgba(0,0,0,.4) inset, 0 1px 0 rgba(255,255,255,.2);
}
/* Form text input */
.form-wrapper input {
width: 330px;
height: 20px;
padding: 10px 5px;
float: left;
font: bold 15px 'lucida sans', 'trebuchet MS', 'Tahoma';
border: 0;
background: #eee;
border-radius: 3px 0 0 3px;
}
.form-wrapper input:focus {
outline: 0;
background: #fff;
box-shadow: 0 0 2px rgba(0,0,0,.8) inset;
}
.form-wrapper input::-webkit-input-placeholder {
color: #999;
font-weight: normal;
font-style: italic;
}
.form-wrapper input:-moz-placeholder {
color: #999;
font-weight: normal;
font-style: italic;
}
.form-wrapper input:-ms-input-placeholder {
color: #999;
font-weight: normal;
font-style: italic;
}
/* Form submit button */
.form-wrapper button {
overflow: visible;
position: relative;
float: right;
border: 0;
padding: 0;
cursor: pointer;
height: 40px;
width: 110px;
font: bold 15px/40px 'lucida sans', 'trebuchet MS', 'Tahoma';
color: #fff;
text-transform: uppercase;
background: #d83c3c;
border-radius: 0 3px 3px 0;
text-shadow: 0 -1px 0 rgba(0, 0 ,0, .3);
}
.form-wrapper button:hover{
background: #e54040;
}
.form-wrapper button:active,
.form-wrapper button:focus{
background: #c42f2f;
outline: 0;
}
.form-wrapper button:before { /* left arrow */
content: '';
border-width: 8px 8px 8px 0;
border-style: solid solid solid none;
border-color: transparent #d83c3c transparent;
top: 12px;
left: -6px;
}
.form-wrapper button:hover:before{
border-right-color: #e54040;
}
.form-wrapper button:focus:before,
.form-wrapper button:active:before{
border-right-color: #c42f2f;
}
.form-wrapper button::-moz-focus-inner { /* remove extra button spacing for Mozilla Firefox */
border: 0;
padding: 0;
}
Close the button tag
You've floated both the search bar and
the button. The parent div won't use the height that the children
occupy, until you insert a div with style "clear:both". You've done
a "clear: both" after the form, and not after the children.
<form class="form-wrapper cf">
<input type="text" placeholder="Search here..." required>
<button type="submit">Go< /button>< div style="clear:both">
</div>
</form>
With respect to aligning it to right top, you need to position it absolute or fixed, and specify the "right" and "top" attributes. Did you even try doing that? Or, did you think that you could copy a snippet from somewhere and Stackoverflow members would fix it for you?
.form-wrapper {
width: 450px;
padding: 15px;
position: absolute;
top:50px;
right: 50px;
background: #444;
background: rgba(0,0,0,.2);
border-radius: 10px;
box-shadow: 0 1px 1px rgba(0,0,0,.4) inset, 0 1px 0 rgba(255,255,255,.2);
}
Here is the fixed code - http://jsfiddle.net/a2ev8/2/

CSS div border changes to black when visited

I have a menu where each link is a div box. This div box have a gray border-bottom, however, when the link is visited it turns black. I just can't figure why.
On the following image I've clicked the Rediger profil and Log af links.
JSFiddle: http://jsfiddle.net/LpGbT/
HTML
<div id="design_sidebar">
<div id="design_sidebar_head">
Patrick Reck
</div>
<div class="design_sidebar_menu_item">Besøgende</div>
<div class="design_sidebar_menu_item">Mine favoritter</div>
<div class="design_sidebar_menu_item">Rediger profil</div>
<div class="design_sidebar_menu_item">Log af</div>
</div>
CSS
a {
text-decoration: none;
}
#design_sidebar {
width: 200px;
float: left;
border: 1px solid #d6d6d6;
-moz-border-radius: 2px;
border-radius: 2px;
background-color: white;
}
#design_sidebar_head {
width: 165px;
height: 30px;
font-family: Segoe;
font-size: 14px;
font-weight: bold;
color: #333333;
padding-top: 10px;
padding-left: 35px;
border-bottom: 1px solid #d6d6d6;
background-image: url('../img/icons/user.png');
background-repeat: no-repeat;
background-position: 10px 11px;
background-color: #f7f7f7;
}
.design_sidebar_menu_item {
padding: 5px;
padding-left: 10px;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #d6d6d6;
}
.design_sidebar_menu_item:hover {
color: white;
background-color: #a6242f;
}
You may define a copied version of your div selector with a :visited suffix in order to set new colours for visited objects.
Aldo div classes are prefixed with a dot (.) instead of a sharp (#) character. Just a reminder. :)
.design_sidebar_menu_item:visited {
border-color: <your_color>;
}
If it doesn't harm your design etc. I would suggest this:
HTML:
<div id="design_sidebar">
<div id="design_sidebar_head">
Patrick Reck
</div>
Patrick Reck
Besøgende
Mine favoritter
Rediger profil
Log af
</div>
CSS:
div#design_sidebar a {
text-decoration: none;
padding: 5px;
padding-left: 10px;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #d6d6d6;
display: block;
}
div#design_sidebar a:hover {
color: white;
background-color: #a6242f;
}
#design_sidebar {
width: 200px;
float: left;
border: 1px solid #d6d6d6;
-moz-border-radius: 2px;
border-radius: 2px;
background-color: white;
}
#design_sidebar_head {
width: 165px;
height: 30px;
font-family: Segoe;
font-size: 14px;
font-weight: bold;
color: #333333;
padding-top: 10px;
padding-left: 35px;
border-bottom: 1px solid #d6d6d6;
background-image: url('../img/icons/user.png');
background-repeat: no-repeat;
background-position: 10px 11px;
background-color: #f7f7f7;
}
EDIT:
How about adding:
a {
text-decoration: none;
display: block;
border-bottom: 1px solid #d6d6d6;
}
And removing border-bottom: 1px solid #d6d6d6; from .design_sidebar_menu_item {...}
The others will need links around them for this to work.
It doesn't..
I changed border-bottom color to 'green'. Now you have a clear view.
Check jsFiddle : check it out
.design_sidebar_menu_item {
padding: 5px;
padding-left: 10px;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #00FF00;
}

Resources