I want to turn the input buttons from grey to black - css

I'm creating a webpage with no js , and the llok I have is perfect except for one the grey input/submit boxes , I've tried all sorts of options with buttons code but cant turn them black or blue or even transparent , is it possible ? if yes how ? someone please help
.input {
background-color: transparent;
background: #7ec2cf;
color: #eaed5e;
font-size: 15px;
line-height: 15px;
padding: 3px;
border-radius: 2px;
font-family: Georgia, serif;
font-weight: bold;
text-decoration: none;
font-style: normal;
font-variant: small-caps;
text-transform: none;
border-color: #7ec2cf;
border-style: #7ec2cf 2px;
display: inline-block;
}
.input:hover {
background: #eaed5e;
color: #7ec2cf
}
.input:active {
background: #7ec2cf;
color: #eaed5e
}
<div class="input">
<input value="Logout" type="submit">
</div>
<input name="a" value="lo" type="hidden">
<input name="s" value="0oiRYW3Nvf0YC1Fk" type="hidden">

html:
<form method="post">
<div>
<input value="Logout" type="button" class="press">
</div>
<input name="a" value="lo" type="hidden">
<input name="s" value="0oiRYW3Nvf0YC1Fk" type="hidden">
</form>
css:
.press {
background-color: blue;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.input:hover { background: #eaed5e; color: #7ec2cf} .input:active { background: #7ec2cf; color: #eaed5e }
Is this what you wanted?

The problem with your css is the selector you're using - .input which represents class names input, for the selecting the button either use -
.input input{
//your code here for the button
}
or
.input>input{
//your code here for the button
}
or just
input {
//your code here for the button
}

Take a look at the following example. Just remove the div and apply the .input class to the input element. Also note that background-color redundant in this case.
.input {
background: #7ec2cf;
color: #eaed5e;
font-size: 15px;
line-height: 15px;
padding: 3px;
border-radius: 2px;
font-family: Georgia, serif;
font-weight: bold;
text-decoration: none;
font-style: normal;
font-variant: small-caps;
text-transform: none;
border-color: #7ec2cf;
border-style: #7ec2cf 2px;
display: inline-block;
}
.input:hover {
background: #eaed5e;
color: #7ec2cf
}
.input:active {
background: #7ec2cf;
color: #eaed5e
}
<input value="Logout" type="submit" class="input">
<input name="a" value="lo" type="hidden">
<input name="s" value="0oiRYW3Nvf0YC1Fk" type="hidden">

Related

How to make the CSS :focus work on my project?

Can anyone help me? I tried to add a border-color using :focus on the form input when the user clicks on the text field. But it doesn't work. Any help is really appreciated. Thank you!
form.customNewsletter-form {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: flex-start;
margin: 0;
padding: 0;
gap: 16px;
}
form.customNewsletter-form input[type="text"] {
font-family: "Roboto", sans-serif;
font-size: 16px;
font-weight: 300;
color: #ffffff;
background-color: #0d0d0d;
border: 1px solid #404040;
width: 70%;
height: 48px;
padding: 0 16px;
letter-spacing: 0.8px;
border-radius: 4px;
margin: 0;
}
form.customNewsletter-form input[type="text"]:focus {
border: 1px solid #cd0d0d;
}
form.customNewsletter-form input::placeholder {
color: #8d8d8d;
}
form.customNewsletter-form input[type="submit"] {
color: #ffffff;
font-family: "Roboto Condensed", sans-serif;
font-size: 16px;
font-weight: 300;
background-color: #cd0d0d;
border: none;
border-radius: 4px;
height: 48px !important;
width: 30%;
letter-spacing: 0.8px;
text-transform: uppercase;
margin: 0 auto !important;
transition: 0.3s all ease;
}
form.customNewsletter-form input[type="submit"]:hover {
background-color: #8e0000;
color: #ffffff;
-webkit-transform: scale(0.99);
transform: scale(0.99) 0.5s ease-in;
}
<form class="customNewsletter-form" action="https://app.getresponse.com/add_subscriber.html" accept-charset="utf-8" method="post">
<!-- Email field (required) -->
<input type="text" name="email" placeholder="Enter your email">
<!-- List token -->
<!-- Get the token at: https://app.getresponse.com/campaign_list.html -->
<input type="hidden" name="campaign_token" value="sample">
<!-- Thank you page (optional) -->
<input type="hidden" name="thankyou_url" value="https://www.website.com/thankyou">
<!-- Add subscriber to the follow-up sequence with a specified day (optional) -->
<input type="hidden" name="start_day" value="0">
<!-- Subscriber button -->
<input type="submit" value="Subscribe">
</form>
Please see here for the demo.
I'm expecting the border-color of the input field to change to red when the user clicks on it.
Add outline:none;
form.customNewsletter-form input[type="text"]:focus {
outline: none;
border: 1px solid #cd0d0d;
}

Custom Checkbox tick not consistent on Edge Browser

I have tried several attempts to make the custom checkbox look consistent across all browsers. The only browser which i am facing problem is of Edge.
I am using decimal code for the tickmark which appears proper in all the major browsers. But for Edge i have to change the font family as Edge browser adapts the Segoe UI Symbol Font. When changing the font the appearance of the checkbox changes and it does not look consistent.
Try running the below code without the font family: Segoe UI Symbol; That is how my original checkbox looked.
label {
display: inline-block;
max-width: 100%;
}
input[type='checkbox'] {
display: none;
box-sizing: border-box;
padding: 0;
outline: none;
border: none;
background: transparent;
width: auto;
}
input[type='checkbox']:checked+.tick_mark {
color: #16a0de;
}
input[type='checkbox']+span {
cursor: pointer;
font-weight: normal;
font-size: 11px;
}
.tick_mark {
border: 1px solid #666;
padding: 0px 1px;
color: white;
margin: 6px 4px 6px 0;
font-weight: normal;
font-family: Segoe UI Symbol;
}
<label>
<input name="postSelected" class="NonUnSaved" id="chkBlog" type="checkbox" value="4">
<span class="tick_mark">✔</span>
<span class="btntooltip" data-val="checkboxTest">Text 1</span>
</label>
Try this.
label {
display: inline-block;
max-width: 100%;
}
input[type='checkbox'] {
display: none;
box-sizing: border-box;
padding: 0;
outline: none;
border: none;
background: transparent;
width: auto;
}
input[type='checkbox']:checked+.tick_mark {
color: #16a0de;
}
input[type='checkbox']+span {
cursor: pointer;
font-weight: normal;
font-size: 11px;
}
.tick_mark {
padding: 0px 1px;
color: white;
margin: 6px 4px 6px 0;
font-weight: normal;
font-family: Segoe UI Symbol;
position: relative;
}
input[type='checkbox'] + .tick_mark:before {
content: '\a0';
display: inline-block;
width: 1.1em;
height: 1.1em;
border: 1px solid #222;
margin-right: 0.25em;
line-height: 1;
position: absolute;
top: 1px;
left: -2px;
}
<label>
<input name="postSelected" class="NonUnSaved" id="chkBlog" type="checkbox" value="4">
<span class="tick_mark">✔</span>
<span class="btntooltip" data-val="checkboxTest">Text 1</span>
</label>
I think the simplest way would be to experiment with padding. This makes a better square in Edge:
.tick_mark {
...
padding: 0px 2px;
...
}
You will have to search for how to apply different css to Edge only but i think it's still possible.
You might not be able to make them all exactly the same, but very close.

Only a CSS class not working, all other CSS are working fine

I am currently working on a web development project.
The problem is that all other CSS are working fine but there is a CSS class for a form just doesn't work. I've no idea what to do.
.actLeadClaims form {
margin:40px 25px;
padding: 10px 20px;
background: #f4f7f8;
border-radius: 8px;
width:465px;
font-family: 'Helvetica Neue', sans-serif;
}
.actLeadClaims h1 {
margin: 0 0 30px 0;
text-align: center;
}
.actLeadClaims input[type="text"],
.actLeadClaims input[type="password"],
.actLeadClaims input[type="date"],
.actLeadClaims input[type="datetime"],
.actLeadClaims input[type="email"],
.actLeadClaims input[type="number"],
.actLeadClaims input[type="search"],
.actLeadClaims input[type="tel"],
.actLeadClaims input[type="time"],
.actLeadClaims input[type="url"],
.actLeadClaims textarea,
.actLeadClaims select {
background: rgba(255,255,255,0.1);
border: none;
font-size: 16px;
height: auto;
margin: 0;
outline: 0;
padding: 15px;
width: 400px;
background-color: #e8eeef;
color: black;
box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
margin-bottom: 30px;
font-family: 'Helvetica Neue', sans-serif;
}
.actLeadClaims input[type="radio"],
.actLeadClaims input[type="checkbox"] {
margin: 0 4px 8px 0;
}
.actLeadClaims select {
padding: 6px;
height: 32px;
border-radius: 2px;
}
.actLeadClaims button {
padding: 19px 39px 18px 39px;
color: #FFF;
background-color: #4bc970;
font-size: 18px;
text-align: center;
font-style: normal;
border-radius: 5px;
width: 100%;
border: 1px solid #3ac162;
border-width: 1px 1px 3px;
box-shadow: 0 -1px 0 rgba(255,255,255,0.1) inset;
margin-bottom: 10px;
}
.actLeadClaims fieldset {
margin-bottom: 30px;
border: none;
}
.actLeadClaims legend {
font-size: 1.4em;
margin-bottom: 10px;
}
.actLeadClaims label {
display: block;
margin-bottom: 8px;
font-family: 'Helvetica Neue', sans-serif;
}
.actLeadClaims label.light {
font-weight: 300;
display: inline;
}
.actLeadClaims .number {
background-color: #5fcf80;
color: #fff;
height: 30px;
width: 30px;
display: inline-block;
font-size: 0.8em;
margin-right: 4px;
line-height: 30px;
text-align: center;
text-shadow: 0 1px 0 rgba(255,255,255,0.2);
border-radius: 100%;
}
<div class="actLeadClaims">
<form action="" method="post" enctype="multipart/form-data">
<fieldset>
<label>Product Name:</label>
<input type="text" name="productName">
<label>Product Brand:</label>
<input type="text" name="productBrand">
<label>Product Series:</label>
<input type="text" name="productSeries">
<label>Comment:</label>
<textarea rows="6" name="productDesciption"></textarea>
<label>Picture:</label>
<input type="file" name="coverToUpload" id="coverToUpload"></br></br>
</fieldset>
<input type="submit" value="Add" name="uploadProduct">
</form>
</div>
However, all these code end up look like this:
Firstly, you've used BR tag in a wrong way. BR is written <br> or <br /> not </br>.
After that, you didn't specify what's your problem but I guess it's about locating labels regularly and make the form look good. If it's so, try the solution below. First, you correct BR tags:
<div class="actLeadClaims">
<form action="" method="post" enctype="multipart/form-data">
<fieldset>
<label>Product Name:</label>
<input type="text" name="productName">
<label>Product Brand:</label>
<input type="text" name="productBrand">
<div class="clear"></div>
<label>Product Series:</label>
<input type="text" name="productSeries">
<label>Comment:</label>
<textarea rows="6" name="productDesciption"></textarea>
<div class="clear"></div>
<label>Picture:</label>
<input type="file" name="coverToUpload" id="coverToUpload"><br><br>
</fieldset>
<input type="submit" value="Add" name="uploadProduct">
</form>
</div>
Then add/modify CSS codes this way:
.actLeadClaims input[type="radio"],
.actLeadClaims input[type="checkbox"] {
margin: 0 4px 8px 0;
}
.actLeadClaims select {
padding: 6px;
height: 32px;
border-radius: 2px;
}
.actLeadClaims button {
padding: 19px 39px 18px 39px;
color: #FFF;
background-color: #4bc970;
font-size: 18px;
text-align: center;
font-style: normal;
border-radius: 5px;
width: 100%;
border: 1px solid #3ac162;
border-width: 1px 1px 3px;
box-shadow: 0 -1px 0 rgba(255,255,255,0.1) inset;
margin-bottom: 10px;
}
.actLeadClaims fieldset {
margin-bottom: 30px;
border: none;
}
.actLeadClaims legend {
font-size: 1.4em;
margin-bottom: 10px;
}
.actLeadClaims label {
margin-bottom: 8px;
font-family: 'Helvetica Neue', sans-serif;
}
.actLeadClaims label.light {
font-weight: 300;
display: inline;
}
.actLeadClaims .number {
background-color: #5fcf80;
color: #fff;
height: 30px;
width: 30px;
display: inline-block;
font-size: 0.8em;
margin-right: 4px;
line-height: 30px;
text-align: center;
text-shadow: 0 1px 0 rgba(255,255,255,0.2);
border-radius: 100%;
}
input,
textarea {
vertical-align: top;
}
label {
display: inline-block;
width: 130px;
text-align: right;
vertical-align: top;
}
.clear {
clear: both;
}
Take a look at the form in jsFiddle. Please expand the output part to see it widely.

Style link as submit button

I have a link and a submit button styled with the same .button class. Is there an easy way to make them look exactly the same (to have a same height)?
body .button {
text-align: center;
line-height: 15px;
background: #3333CC;
border-color: #5033CC;
border-radius: 4px;
color: #fff;
font-size: 11px;
border: 1px solid;
padding: 4px 7px 4px 7px;
cursor: pointer;
min-width: 90px;
text-decoration: none;
display: inline-block;
}
<form>
<a class="button" href="http://www.example.org">Link as button</a>
<input class="button" type="submit" value="button as button"/>
</form>
EDIT: I just found out that they look the same in Google Chrome, but not in Firefox.
In this example, they do have the same height (25pixels). You can always set a height in the CSS.
One thing you missed is changing the font-family.
In this example I've added one just to Helvetica, but that will make them more similar.
You can set box-sizing:border-box, set a solid height (25px in this example) and then change display:inline-block; to float:left;
body .button {
text-align: center;
line-height: 15px;
background: #3333CC;
border-color: #5033CC;
border-radius: 4px;
color: #fff;
font-size: 11px;
border: 1px solid;
padding: 4px 7px 4px 7px;
cursor: pointer;
min-width: 90px;
text-decoration: none;
float:left;
font-family:'Helvetica';
box-sizing:border-box;
height:25px;
}
<form>
<a class="button" href="http://www.example.org">Link as button</a>
<input class="button" type="submit" value="button as button"/>
</form>

Position elements on a form using CSS

I need to align labels and inputs of my form using CSS. The result should be something like this (I hope this simple scheme is clear):
Label1: ______
Labellll2: ______
Button
So, my HTML and CSS look as follows. The problem is that labels are placed on top of inputs, and also the button is on the right side instead of a bottom.
<form width="200px" name="optform" method="post" action="#">
<div class = "boxx">
<label for="param1">Param1:</label>
<input type="text" class="input-text" value="5" size="11" maxlength="11" name="param1" id="param1">
<label for="param2">Param1:</label>
<input type="text" class="input-text" value="5" size="11" maxlength="11" name="param2" id="param2">
</div>
<div class="buttons">
<a href="#">
<img src="images/opt.png" alt=""/> Run
</a>
</div>
div.boxx {
width: 500px;
}
div.boxx .input-text{
border:1px solid #A9C7F5;
color: #00557F;
font: 12px Arial;
float:left;
width:66%;
margin:0 0 0.5em 0.25em;
}
div.boxx label{
display:block;
font: 13px Arial;
color:#00557F;
width:33%;
float:left;
text-align:left;
padding-right: 8px;
}
.buttons a, .buttons button {
-moz-border-bottom-colors: none;
-moz-border-image: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DFF4FF;
border-color: #EEEEEE #DEDEDE #DEDEDE #EEEEEE;
border-style: solid;
border-width: 1px;
color: #565656;
cursor: pointer;
font-family: Verdana,arial,sans-serif;
font-size: 11px;
font-weight: bold;
line-height: 130%;
margin: 10px 10px 0 0;
padding: 4px 10px 3px 7px;
text-decoration: none;
}
.buttons button {
overflow: visible;
padding: 4px 10px 3px 7px;
width: auto;
}
The label needs to be
display:inline-block;
and the width is too large of either your label or input boxes. Padding and margins will cause problems with percentage widths because they are not taken into account.
Here is the updated css
div.boxx {
width: 500px;
}
div.boxx .input-text{
border:1px solid #A9C7F5;
color: #00557F;
font: 12px Arial;
width:60%;
margin:0 0 0.5em 0.25em;
}
div.boxx label{
display:block;
font: 13px Arial;
color:#00557F;
width:33%;
float:left;
text-align:left;
padding-right: 8px;
}
.buttons a, .buttons button {
-moz-border-bottom-colors: none;
-moz-border-image: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DFF4FF;
border-color: #EEEEEE #DEDEDE #DEDEDE #EEEEEE;
border-style: solid;
border-width: 1px;
color: #565656;
cursor: pointer;
font-family: Verdana,arial,sans-serif;
font-size: 11px;
font-weight: bold;
line-height: 130%;
margin: 10px 10px 0 0;
padding: 4px 10px 3px 7px;
text-decoration: none;
}
.buttons button {
overflow: visible;
padding: 4px 10px 3px 7px;
width: auto;
}
I know modern CSS people hate tables, but in this case (and with many alignment issues with divs) I recomment a nice little table.
<table>
<tr>
<td>Label1: </td><td><input type="text" /></td>
</tr><tr>
<td>Label2: </td><td><input type="text" /></td>
</tr><tr>
<td>Label3: </td><td><input type="text" /></td>
</tr>
</table>
<input type="button" />
Try something like this http://jsfiddle.net/mmyxD/
Is there a reason for all the margins/padding? Your width's are forcing the elements onto new lines.
You can also use divs and spans. Something like this:
<form action="">
<div class="row"><span class="label">label1:</span><span class="formw"><input type="text" size="25"></span></div>
<div class="row"><span class="label">label2:</span><span class="formw"><input type="text" size="25"></span></div>
<div class="spacer"> </div>
</form>
and css:
div.row {
clear: both;
padding-top: 10px;
}
div.row span.label {
float: left;
width: 33%;
text-align: left;
}
div.row span.formw input{
width: 100%;
}
div.row span.formw {
float: right;
width: 66%;
text-align: left;
}

Resources