How to edit the style of a web form - html

So in my CSS I already have a class for my text which makes a clear white box appear behind the text to make it more readable, I would also like to do this for my login page, Id like to make it a black box in the middle of the screen sort of like the steam login page https://store.steampowered.com/login/ but putting it in a div and class doesnt seem to work.
ive tried putting the div in the form and ive also tried putting the form in the div
</div>
<form>
<div class="acc">
Username:<br>
<input type="text" name="Username">
<br>
Password:<br>
<input type="text" name="Password">
</div>
</form>
.acc(
font-family: "Times New Roman", Times, serif;
font-style: normal;
font-weight: normal;
font-size: 30px;
line-height: normal;
color: #000000;
margin-left: auto;
margin-right: auto;
background-color:black;
text-align:center;
vertical-align: middle;
padding:20px 47px;
}

Try styling the input elements either directly or by applying a class to them. See a working demo below:
body {
background-color: #252831;
color: white;
}
.container {
display: flex;
flex-direction: column;
}
form {
display: flex;
flex-direction: column;
width: 200px;
}
.input-wrap {
margin: 5px;
}
input {
background-color: #353A47;
border: 1px solid #4C4B63;
}
<div class="container">
<form>
<div class="input-wrap">
<label>Username:</label>
<input type="text">
</div>
<div class="input-wrap">
<label>Password:</label>
<input type="password">
</div>
</form>
</div>

Although this is similar to another answer, I've changed the font colour so it will display, rather than black text on a black background
input {
font-family: "Times New Roman", Times, serif;
font-style: normal;
font-weight: normal;
font-size: 30px;
line-height: normal;
color: #ffffff;
margin-left: auto;
margin-right: auto;
background-color:black;
text-align:center;
vertical-align: middle;
padding:20px 47px;
}

Related

How do I make this layout change based on viewport width?

So I've been formatting this form and it looks ok on Desktop now.
But I need it to change when it's on mobile.
It's two elements, one image and one form, side by side.
I need them to change to top and bottom when on mobile.
Probably a #media query CSS?
I've tried using percentages for widths, but the image size isn't changing and the form component either ends up overlapping it, or it gets cut off...
HTML Code:
<head>
<link rel="stylesheet" href="/assets/signup.css">
</head>
<!-- Begin Mailchimp Signup Form -->
<div id="mc_embed_signup">
<div id="image"><img src="images/genesis.gif"></div>
<form action="https://opipets.us17.list-manage.com/subscribe/post?u=3fa8d83aedc08e2a8814c787c&id=27f9c81072&v_id=4140&f_id=00bb56e0f0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h2>Join our Whitelist</h2>
<div class="mc-field-group">
<label for="mce-EMAIL">Email
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL" required>
<span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>
</div>
<div id="mergeRow-gdpr" class="mergeRow gdpr-mergeRow content__gdprBlock mc-field-group">
<div class="content__gdpr">
<span>
<fieldset class="mc_fieldset gdprRequired mc-field-group" name="interestgroup_field">
<label class="checkbox subfield" for="gdpr_90860"><input type="checkbox" id="gdpr_90860" name="gdpr[90860]" value="Y" class="av-checkbox gdpr"></label>
</fieldset>
<p><b>I agree to receive communications from Opis Group Ltd</b></p>
</span>
<br>
<p>Your privacy is our policy. Occasionally, we'll contact you about our products and services, and other content that may be of interest. You can unsubscribe at any time.</p>
<p>We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. </p>
<br>
<p>Learn more about Mailchimp's privacy practices here.</p>
</div>
</div>
<div hidden="true"><input type="hidden" name="tags" value="6456416,6456520"></div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_3fa8d83aedc08e2a8814c787c_27f9c81072" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->
CSS Code:
#font-face {
font-family: museo-sans;
src: url(/fonts/museosans_300.otf) format("opentype");
font-display: auto;
font-style: normal;
font-weight: 300;
font-stretch: normal
}
#font-face {
font-family: museo-sans-bold;
src: url(/fonts/museosans_700.otf) format("opentype");
font-display: auto;
font-style: normal;
font-weight: 700;
font-stretch: normal
}
#font-face {
font-family: bwstretch;
src: url(/fonts/BWSTRETCH-BLACK.OTF) format("opentype");
font-display: auto;
font-style: normal;
font-weight: 800;
font-stretch: normal
}
a {
font-family: museo-sans-bold;
color: #ffc860;
}
h2 {
font-family: bwstretch;
text-align: center;
text-transform: uppercase;
font-size: 3vh !important;
}
body {
font-size: 1.5vh;
background-color: #191f43;
font-family: museo-sans;
color: #191f43;
}
#mc_embed_signup {
width: 90% overflow: auto;
height: 90%;
display: flex;
align-items: center;
justify-content: center;
vertical-align: middle;
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
color: #191f43;
}
div.mc-field-group {
width: 90% overflow: auto;
}
div.mc-field-group label {
font-size: 2vh;
font-family: museo-sans-bold;
width: auto;
}
div.mc-field-group input {
font-size: 1.5vh;
font-family: museo-sans-bold;
width: 90%;
color: #191f43;
border: 0;
height: 30px;
border-radius: 5px;
padding-left: 10px;
padding-bottom: 10px;
padding-top: 10px;
margin-left: 10px;
}
#image {
max-width:30% overflow: auto;
background-color: #191f43;
}
#content__gdpr {
display: flex;
justify-content: center;
align-items: center;
}
#mc_embed_signup {
width: 90%;
background-color: #191f43;
color: #ffc860;
font-family: museo-sans;
}
#mc-embedded-subscribe-form input[type=checkbox]{
display: flex;
width: auto;
margin-right: 0px;
margin-left: -15px;
margin-top: -2px;
}
#mergeRow-gdpr {
margin-top: 20px;
font-size: 1.5vh;
}
#mergeRow-gdpr fieldset label {
font-weight: normal;
}
#mc-embedded-subscribe-form .mc_fieldset {
border:none;
min-height: 0px;
padding-bottom:0px;
}
input.button {
color: #191f43;
background-color: #ffc860;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 45px;
padding-right: 45px;
font-family: bwstretch;
text-transform: uppercase;
font-size: 1.5em;
border: 0;
border-radius: 40px;
}
span {
display: flex;
align-items: center;
}
#Media works like this:
#media (max-width: 768px) {
h2{
background-color: #ffc860;
}
}
768px is generally regarded as a breaking point between vertical(smartphone) view and horizontal(Tablet, Desktop) view.
I would recommend to do every class twice one for bellow 768px screen width and one for above.

Align text on the side and top of other text css

How can I achieve this using css?
This is what I've tried:
<label style="position:absolute; top:-15px; margin-left: 20px; font-size:18px"">R$</label>
<label style="margin-left:45px; font-size: 35px;>54.133</label>
<label style="position:absolute; top:-15px;>48</label>
I think you dont even need that, just a little bit beautifuler
Origin
$234 07-04
After add style
<p style="font-size: 30px; font-weight: lighter; color: rgba(57, 152, 27, 0.97);"><sup style="font-size: 15px;">$</sup>234<sup style="font-size: 15px;">07-04</sup></p>
Please use downbelow style, dont mix html and style, that's terrible
.normal{
font-size: 30px;
font-weight: normal;
color: rgba(57, 152, 27, 0.97);
}
.upper{
font-weight: lighter;
font-size: 15px;
}
<p class="normal">
<sup class="upper">$</sup>234<sup class="upper">07-04</sup>
</p>
label{
font-size:20px;
}
label sup{
font-size: 12px;
vertical-align: top
}
<label><sup>R$</sup>54.133<sup>73</sup></label>
Use superscript tag
<label><sup>R$</sup>54.133<sup>73</sup></label>
https://www.w3schools.com/tags/tag_sup.asp
This is the css solution to achieve the superscript.Just try this:
<label style="position:relative; top:-0.5em; margin-left: 20px; font-family: 'Segoe UI Light'; font-size:18px"">R$</label>
<label style="margin-left:45px; font-size: 35px; font-family: 'Segoe UI Light'" runat="server" id="lblBalancePeriod">54.133</label>
<label style="position:relative; top:-0.8em;">48</label>
HTML:
<span class="currency">
<span class="prefix">R$</span>
54.133
<span class="suffix">73</span>
</span>
CSS:
.currency {
color: green;
font-size: 40px;
line-height: 40px;
}
.prefix, .suffix {
font-size: 20px;
vertical-align: text-top;
}
Shown in Plunker.
You can use flexbox:
<div class="container">
<label class="sign">R$</label>
<label class="number">54.133</label>
<label class="decimal";>48</label>
</div>
<style>
.container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
label.sign{
align-self: flex-start;
font-size: 20px;
}
label.number{
font-size: 30px;
}
label.decimal{
align-self: flex-start;
font-size: 20px;
}
</style>
More Here

How can I wrap checkbox form elements in CSS?

I am working on some code that presents a form with a number of checkboxes. I would like to get the checkboxes to wrap to a second (and third, and fourth) line, but am having trouble doing so. At the moment, the checkboxes run straight off the page in a line without wrapping.
There are 10 (or more) checkboxes, but for the sake of brevity I've listed only a few of them since listing all of them wouldn't really add to the conversation:
My CSS:
.add-to-cart .attribute label {
display: inline;
padding-right: 35px;
}
.add-to-cart .form-checkboxes{
max-width: 600px;
height: 300px;
display: inline-flex;
}
.add-to-cart .attribute .form-item .form-type-checkbox {
position: absolute;
display: inline-block;
width: 100%;
height: 90px;
background-color: #ddd;
padding: 20px;
margin: 10px;
white-space: nowrap;
text-align: center;
vertical-align: middle;
font: bold 10px verdana, arial, 'Raleway', sans-serif;
font-style: italic;
}
My HTML/Code:
<div class="content">
<div class="add-to-cart">
<form class="ajax-cart-submit-form" action="/this-product" method="post" id="uc-product-add-to-cart-form-7" accept-charset="UTF-8">
<div class="attribute attribute-7 even">
<div class="form-item form-type-checkboxes form-item-attributes-7">
<label for="edit-attributes-7">Extras </label>
<div id="edit-attributes-7" class="form-checkboxes">
<div class="form-item form-type-checkbox form-item-attributes-7-49">
<input type="checkbox" id="edit-attributes-7-49" name="attributes[7][49]" value="49" class="form-checkbox" />
<label class="option" for="edit-attributes-7-49"> Blue </label>
</div>
<div class="form-item form-type-checkbox form-item-attributes-7-43">
<input type="checkbox" id="edit-attributes-7-43" name="attributes[7][43]" value="43" class="form-checkbox" />
<label class="option" for="edit-attributes-7-43"> Red </label>
</div>
<div class="form-item form-type-checkbox form-item-attributes-7-50">
<input type="checkbox" id="edit-attributes-7-50" name="attributes[7][50]" value="50" class="form-checkbox" />
<label class="option" for="edit-attributes-7-50"> Green </label>
</div>
</div>
</div>
</div>
</div>
</div>
Try this
.add-to-cart .attribute label {
display: inline;
padding-right: 35px;
}
.add-to-cart .form-checkboxes{
max-width: 600px;
height: 300px;
display: inline-flex;
}
.add-to-cart .attribute .form-checkboxes:not(.form-item) {
position: absolute;
display: inline-flex;
width: 100%;
height: 90px;
background-color: #ddd;
padding: 20px;
margin: 10px;
white-space: nowrap;
text-align: center;
vertical-align: middle;
font: bold 10px verdana, arial, 'Raleway', sans-serif;
font-style: italic;
}
live demo - https://jsfiddle.net/91r7v20q/
Well, I figured it out. I changed this CSS code:
.add-to-cart .form-checkboxes{
max-width: 600px;
height: 300px;
display: inline-flex;
}
To this:
.add-to-cart .form-checkboxes{
max-width: 600px;
display: inline-block;
}
I removed the fixed height to allow the block to be flexible in allowing the elements to be completely displayed before the last row (with the submit button, see comments on this questions). Whew!

Why does this css not center the submit button on this form?

I want to center this submit button, using CSS, and have researched this in many other online posts, but have not yet found a solution, which seems odd for something that should be so simple.
td.class > div {
width: 100%;
height: 100%;
overflow: hidden;
height: 20px;
}
#buttonstyle {
border: 2px solid #777777;
background: #019966;
color: black;
font: bold 18px'Trebuchet MS';
padding: 4px;
cursor: pointer;
width: 150px;
border-radius: 12px;
display: inline-block;
margin: 0px auto;
}
.buttonHolder {
text-align: center;
}
.heading {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bold;
text-align: center;
color: #006633;
}
input {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
}
input[type=text] {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
input[type=date] {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
ul {
list-style: none;
text-align: left;
}
input {
width: 20px;
position: relative;
left: 150px;
vertical-align: middle;
}
label {
width: 200px;
position: relative;
left: -20px;
display: inline-block;
vertical-align: middle;
}
<form name="InstructorForm" action="../instructorDB_protected/instructorDB_controller.php" method="post" enctype="multipart/form-data">
<div id='content'>
<center>
<span class="heading">Colorado Mountain Club - Boulder Group Instructor Database<br>Instructor Administrator Export Form</span>
</p>
<p>
Select which schools to export to a file to download.
<br>The file will contain a list of instructor names, emails and phone numbers:
<p>
<div id="yourdiv" style="display: inline-block;">
<ul>
<li>
<input type="checkbox" name="avi_instructor">
<label>Avalanche:</label>
</li>
<li>
<input type="checkbox" name="hiking_instructor">
<label>Hiking:</label>
</li>
<li>
<input type="checkbox" name="ice_instructor">
<label>Ice:</label>
</li>
<li>
<input type="checkbox" name="rock_instructor_trad">
<label>Rock, Trad:</label>
</li>
<li>
<input type="checkbox" name="rock_instructor_sport">
<label>Rock, Sport:</label>
</li>
<li>
<input type="checkbox" name="ski_instructor">
<label>Ski:</label>
</li>
<li>
<input type="checkbox" name="snow_instructor">
<label>Snow:</label>
</li>
</ul>
</div>
<br>
<div class="buttonHolder">
<input id=buttonstyle type="submit" name="submitAdminExport" value="Export">
</div>
<br>
Return to top
</center>
</div>
</form>
I have experimented with removing three other CSS files that get loaded, which did not make any difference: the submit button refuses to center, and aligns itself along the right margin of the checkboxes, in the list above it. Any help much appreciated!
just cancel left property on input
#buttonstyle{
left: auto;
}
Which u gave here
input{
width:20px;
position:relative;
left: 150px;
vertical-align:middle;
}
or you can just simply write like that
input:not(#buttonstyle){
width:20px;
position:relative;
left: 150px;
vertical-align:middle;
}
which would be more elegant to NOT include your button styles on input styles :)
And HINT for you, use web developers tools in future and see what happen there, mostly in 99% of cases you can solve your problems by watch what styles you got on specific elements :)
hope it helps you,
cheers
Your left property on input is the cause of the misalignment.
Change this:
input{
width:20px;
position:relative;
left: 150px;
vertical-align:middle;
}
To this:
#yourdiv input{
width:20px;
position:relative;
left: 150px;
vertical-align:middle;
}
So that the left: 150px; property will only apply to input elements under the #yourdiv div.
Link to jsFiddle: https://jsfiddle.net/AndrewL32/e0d8my79/101/
Very simply, its all because of the position:relative...
Update your button to be:
<input id="buttonstyle" type="submit" name="submitAdminExport" value="Export" style="position: static;">

How to position the submit button?

I'm looking to make an offline search page powered by Google. I am having a little trouble with the search button though, it just seems to do whatever it wants. I want it to be relative above the textarea on the left. I would like for it to stay in that corner of the textarea even when the textarea is expanded. (This webpage is not designed for multi-browser supported it is, designed for Firefox only.)
<style>
body{
background: url(bg.jpg);
background-size: cover;}
textarea{
display: block;
margin-left: auto;
margin-right: auto;
background-color: black;
border-radius: 12px;
color: #ffffff;
font-family:"Courier New", Courier, monospace;
font-size: 16px;
text-decoration: none;
cursor: poiner;
border: none;}
button{
background-color: #000000;
border-radius: 12px;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
text-decoration: none;
cursor: poiner;
border: none;}
button:hover{
border: none;
background: #5B93F5;}
footer{
position: absolute;
bottom: 0px;
right: 0px;
text-align: right;
color: #FFFFFF;}
</style>
</head>
<body>
<div id="searchContainer">
<form id="searchForm" name="searchForm" onsubmit="onSearchSubmit(event)">
<button id="searchSubmit" type="submit" value="Search" title="Google Search">
<font color="blue">G</font><font color="red">o</font><font color="yellow">o</font><font color="blue">g</font><font color="green">l</font><font color="red">e</font>
</button>
<textarea id="searchText" type="text" name="q" maxlength="255" rows="3" cols="50" autocomplete="off" autofocus></textarea>
</form>
</div>
<footer>v5.0</footer>
</body>
</html>
Add following in your css code:
#searchContainer { text-align: center; }
#searchContainer > form { display: inline-block; text-align: left; }
it should resolve your issue.
For the code you have, you can add a padding to the container: JS Fiddle
Add this line to your CSS:
#searchContainer{padding: 2em; display: inline-block;}
For a little more style if you want them connected, you can adjust some border-radius' and margins of the button and text area: JS Fiddle 2