add style to the entered text in input field - css

please tell me how can I add a style padding-left or margin-left to the text that was entered in input field
<input name="keyword" type="text" placeholder="Job title, Keywords or Company Name"/>

input {
padding-left: 10px;
}
<input name="keyword" type="text" placeholder="Job title, Keywords or Company Name"/>

there are multiple ways to add style.
most preferable is
<input name="keyword" type="text" class="txtCSS" placeholder="Job title, Keywords or Company Name"/>
and then add style to that class like,
.txtCSS{
margin-left: 10px;
padding-left: 10px;
//you can add more styles if you require.
}
second way is to bind css inline like these, but it's not preferable and mostly used when need to apply style on page only.
<input name="keyword" type="text" Style="margin-left:10px; padding-left:10px;" placeholder="Job title, Keywords or Company Name"/>

you can add class or id to particular input and you can give style to it.
.abcd{
padding-left:15px;
}
<input name="keyword" type="text" class="abcd" placeholder="Job title, Keywords or Company Name"/>

Related

Spacing between checkbox and text?

I'm having trouble figuring out how to add custom CSS to add spacing between a checkbox and text ( Ship to a different address?). Anytime I add margin or padding the whole element (checkbox + text) is moved. See picture attached?
Thanks for your help!
https://roynattivmd.com/checkout/
Checkbox and text:
You could add some spacing by adding margin-right: [value]; to the specific input. Since you are using elementor, you might do this via inline-styles.
<label for="myInput">
<input id="myInput" type="checkbox" style="margin-right: .5rem;">
Ship to a different address?
</label>
Or via an external stylesheet:
#myInput {
margin-right: .5rem;
}
<label for="myInput">
<input id="myInput" type="checkbox">
Ship to a different address?
</label>
Please try this code,To Spacing between checkbox and text?
dd label input {
margin-right:10px;
}
<dd id="rr-element">
<label for="rr-1">
<input type="checkbox" value="1" id="rr-1" name="rr[]">
Value 1
</label>
</dd>
I hope this code will be useful.
Thank you.

Hide Label, But Show Placeholder at the same time?

I have a form with this code:
<div id="zipcode-label" class="f-label"><label for="zipcode" class="required">Zip code</label></div>
<div id="first-element" class="f-element"><input type="tel" class='rounder' size="5" name="zipcode" id="zipcode" placeholder="Your Zip code" value="" tabindex="2" pattern="[0-9]{5}" title="Five digit zipcode" required></div>
I want to hide the label part (I don't want to delete it), so I tried using style="display:none", but for some reason it also hides the placeholder of the field.
Any way to resolve this?
Hiding the label with display:none; should not effect the placeholder of the input:
label[for="zipcode"] {
display:none;
}
<div id="zipcode-label" class="f-label"><label for="zipcode" class="required">Zip code</label></div>
<div id="first-element" class="f-element"><input type="tel" class='rounder' size="5" name="zipcode" id="zipcode" placeholder="Your Zip code" value="" tabindex="2" pattern="[0-9]{5}" title="Five digit zipcode" required></div>
Try with this
.f-label label{display:none}
#zipcode-label {
display: none;
}
works for me in JSFiddle, but I don't have your internal or external stylesheets so that may be a huge part of the equation

How to remove textbox css style from input[type='text']

In my whole application i have globally declared textbox style as in css
input[type='text'], input[type=password], textarea { //My styles }
I need to remove this style from search textbox
<input id="txtSerach" type="text" placeholder="Search here..." required />
input[type='text']:not(#txtSearch), input[type=password], textarea { //My styles }
If it is HTML5 you can also use input type="search" and use different css for all search fields
<input id="txtSerach" type="search" placeholder="Search here..." required />

How do I make the width/length of a form field longer using CSS?

I have a form field box with class CCPPDisplayTD.
I'm trying to make it's length longer with CSS styling.
How do I use CSS to accomplish this?
<form>
<input type="text" /><br />
<input type="text" class="CCPPDisplayTD" />
</form>
.CCPPDisplayTD{
width: 200px;
}
See here: http://jsfiddle.net/GT8jD/
In your stylehseet you need the following:
.CCPPDisplayTD{
width: 250px; // whatever size you need.
}
Your HTML needs to resemble something similar to:
<form>
<label> /* Label elements are required for better accessibility */
<input type="text" class="CCPPDisplayTD" />
</label>
</form>
Or the following:
<form>
<label for="input-name"> /* Label elements are required for better accessibility */
<input type="text" class="CCPPDisplayTD" id="input-name" name="input-name" />
</label>
</form>

CSS Form Styling #2

I have seen forms that can do this without using <br /> etc.
Here's my form:
<form id="staff-login" name="staff-login" action="/staff/login/" method="POST">
<label for="staff-login-email">Email</label>
<input type="text" id="staff-login-email" name="email" value="" />
<label for="staff-login-address">Password</label>
<input type="password" id="staff-login-password" name="password" value="" />
<input type="submit" id="staff-login-submit" name="submit" value="Login" />
</form>
And an example of what I'm taking about:
http://img694.imageshack.us/img694/4879/43201622.gif
All the examples I can Google insert extra <div>s and mess with the code, I'm wondering if there is a way with the code I have (or if you can structure my code "better") to achieve what I need?
using css, float your label to the left. Also, make your input elements blocks with a decent margin...
label { float: left; width: 200px; }
input { margin-left: 220px; display: block; }
input.staff-login-submit { margin-left: 500px }
I've just guessed at a few numbers for the margins, so tweak as needed.
<label> and <input> are inline elements. Either you use <br /> (which is totally ok) or you specify them as block elements via CSS.
You can learn more about inline and block elements.

Resources