Login Form Style - css

I am trying to build a login form, however the submit button, remember me checkbox, and remember me label are not being properly formatted. Currently, the label is on the left, and then the submit button and checkbox. I would like it so that the label and checkbox appear after the submit button. I am using Jade for the template engine. I would also like the solution to work properly on mobile browsers.
Jade
doctype html
html
head
title
| Log In
meta(charset = "UTF-8")
meta(name = "viewport" content = "width = device-width, initial-scale = 1.0")
link(rel = "stylesheet", href="/stylesheets/login.css")
body
form#logIn(name = "logIn", method = "post", action = "/login")
p#loginMessage Title
label(for = "handle") Username:
input#handle(type = "text", required = "required", name = "handle" maxlength = "20" value = handle)
br
br
label(for="pass") Password:
input#password(type = "password", required = "required", maxlength = "60" name = "pass")
br
br
div#submitDiv
button#submit(name = "submit") SUBMIT!
label#rememberMe(for = "rememberMeCheckbox") Remember Me:
input#rememberMeCheckbox(type = "checkbox", name = "remember")
br
br
div#errorMessage #{errorMessage}
CSS
#loginMessage {
font-size: 30px;
text-align: center;
color: #FFFFFF;
}
form {
font-weight: bold;
font-family: courier;
font-size: .875em; /*14*/
margin: auto;
width: 90%;
height: 80%;
border: 1px solid #FBFF06;
background: #EFBA00;
-webkit-border-radius: 3.125em; /*50*/
-moz-border-radius: 3.125em;
border-radius: 3.125em;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);
}
label {
display: block;
float: left;
width: 15%;
padding-left: 3%;
padding-right: 3%;
}
input[type="text"], input[type="password"] {
width: 50%;
}
#errorMessage {
font-weight: bold;
font-family: courier;
font-size: 1em;
text-align: center;
}
div#submitDiv {
text-align: center;
display: inline;
}
button#submit {
width: 10%;
background: #FBFF06;
color: #000000;
border: 2px solid #BC8507;
height: 25px;
font-weight: bold;
}
label#rememberMe {
width: 15%;
}
input#rememberMeCheckbox {
width: 10px;
margin: 0 auto;
}

Your label has a float: left style applied to it which is why it's not displaying in the same order as your HTML.
You need to remove the float for just that label and display it as inline to keep everything all on the same line.
label#rememberMe {
width: 10%;
float: none;
display: inline;
}
Check this fiddle: http://jsfiddle.net/ap68p5zg/1/
I also added a min-width to your Submit button so it won't cut off the text and a margin for alignment.
button#submit {
width: 10%;
background: #FBFF06;
color: #000000;
border: 2px solid #BC8507;
height: 25px;
font-weight: bold;
margin-left: 3%;
min-width: 75px;
}

Related

Differenciate between different .CSS?

My problem is that I have in my code the following .CSS for the structure "form":
form, .content {
font-family: Arial, Helvetica, sans-serif; /*Not yet a member? Sign up*/
width: 30%;
margin: 0px auto;
padding: 20px;
border: 1px solid #595959; /*Border register*/
background: white;
/*border-radius: 0px 0px 10px 10px;*/
}
But I would like it to be different for the button I have (I don’t want a border with a width):
<form action="#" method="post">
<input type="hidden" id="hiddenfield" name="hiddenfield">
<button class="button" name="search">Search</button>
</form>
I would want it to be with these characteristics:
.button {
display: block;
margin: auto;
border: none;
color: black;
padding: 8px 40px;
text-align: center;
text-decoration: none;
font-size: 16px;
cursor: pointer;
}
button:hover {
background:#333333;
color: white;
}
However, the .CSS of the structure is also applied to the button. I would like to differentiate it, but I do not know how. I have tried in several ways, including:
form, .button {
display: block;
margin: auto;
border: none;
color: black;
padding: 8px 40px;
text-align: center;
text-decoration: none;
font-size: 16px;
cursor: pointer;
}
Could you help me?
Thank you
The image of the button is here:
You need to know weights of elements in css
element (span, input, form...) = 1
class (.my-class) = 10
id (#my-id) = 100
attribute (style="color:red") = 1000
form, .button { - style for form and button (separate)
form .button { - style for only button (weight 1 + 10 = 11)
form button.button { here you can override previous styles for element .button (weight 1 + 1 + 10 = 12)
form {
border: none !important;
}
In your case not input has border, but form

CSS fill parent width

I'm struggling to set the div width to the remaining width of the container div. In the example below I want the red div (an input) to take as much space as possible. If you enter anything in the input the green div appears, which should always be right aligned.
I don't want to use either flex nor display: table-* or workarounds like setting overflow: hidden for to make space for floats.
EDIT: I'm looking for any solution that works for IE10+ (including display: table-*, etc.)
Example: https://codesandbox.io/s/23xo3wjjrp (Change the template and style tag inside /components/SearchBox.vue for changes)
The example uses vue, but for completeness I post the code here too:
HTML
<div class="ms-Fabric ms-SearchBox" :class="searchBoxStyle">
<div class="ms-SearchBox-iconContainer">
<i class="ms-SearchBox-icon ms-Icon ms-Icon--Search"></i>
</div>
<input class="ms-SearchBox-field" type="text" placeholder="Search"
v-model="searchQuery" ref="input"
#blur="onBlur" #focus="onFocus">
<div class="ms-SearchBox-clearButton" v-show="searchQuery.length > 0"
#click="clear">
<i class="ms-SearchBox-icon ms-Icon ms-Icon--Clear"></i>
</div>
</div>
SCSS
// Active styles
.ms-SearchBox.is-active {
.ms-SearchBox-iconContainer {
width: 4px;
transition: width .167s;
.ms-SearchBox-icon {
opacity: 0;
}
}
}
// Static styles
.ms-SearchBox {
display: inline-block;
font-size: 0px;
font-weight: 400;
color: #333;
border: 1px solid #a6a6a6;
height: 32px;
padding-left: 8px;
width: 208px;
.ms-SearchBox-iconContainer {
font-size: 14px;
color: #106ebe;
transition: width .167s;
.ms-SearchBox-icon {
opacity: 1;
transition: opacity .167s 0s;
}
background: rgba(0, 0, 0, 0.2);
}
.ms-SearchBox-field {
display: inline-block;
font-size: 14px;
margin: 0;
padding: 0;
text-overflow: ellipsis;
overflow: hidden;
border: none;
outline: 1px solid transparent;
height: 32px;
vertical-align: top;
background: rgba(255, 0, 0, 0.2);
}
.ms-SearchBox-iconContainer,
.ms-SearchBox-clearButton {
display: inline-block;
height: 32px;
line-height: 32px;
width: 32px;
text-align: center;
}
.ms-SearchBox-clearButton {
font-size: 14px;
background: rgba(0, 255, 0, 0.2);
&:hover {
cursor: pointer;
}
}
}
You should try to set a width:100% to your input, and to set position:absolute to your icon containers. With paddings on the input, this should do the thing.
Hope I understood the question :)

How do I modify the jquery-token-Input css file to create to get a much bigger text area and tokens like described below?

I am using jqueryInputToken and acts-as-taggable-on gem. I was able to make the back-end work. However, as part of using the jqueryTokenInput plugin, my text_area became so slim and looks more like a tiny text_field.
Here is a picture of what my text_area looks like as a result of the jQueryInput plugin without hovering:
And when you hover the "X" sign to delete the tag apears like in the picture below:
I want to modify the css so that the text_area becomes big and the token looks exactly like below:
How should I modify the css below to reach my desired look for the text_field and tokens ?
Here is the css:
/* Example tokeninput style #2: Mac Style */
fieldset.token-input-mac {
position: relative;
padding: 0;
margin: 5px 0;
background: #fff;
width: 400px;
border: 1px solid #A4BDEC;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
fieldset.token-input-mac.token-input-dropdown-mac {
border-radius: 10px 10px 0 0;
-moz-border-radius: 10px 10px 0 0;
-webkit-border-radius: 10px 10px 0 0;
box-shadow: 0 5px 20px 0 rgba(0,0,0,0.25);
-moz-box-shadow: 0 5px 20px 0 rgba(0,0,0,0.25);
-webkit-box-shadow: 0 5px 20px 0 rgba(0,0,0,0.25);
}
ul.token-input-list-mac {
position: relative;
overflow: hidden;
height: auto !important;
cursor: text;
font-size: 12px;
min-height: 1px;
z-index: 999;
margin: 0;
padding: 0;
background: transparent;
}
ul.token-input-list-mac.error {
border: 1px solid #C52020;
}
ul.token-input-list-mac li {
list-style-type: none;
}
li.token-input-token-mac p {
display: inline;
padding: 0;
margin: 0;
}
li.token-input-token-mac span {
color: #231C34;
margin-left: 5px;
font-weight: bold;
cursor: pointer;
}
/* TOKENS */
li.token-input-token-mac {
position: relative;
display: inline-block;
width: auto !important;
font-size: 8pt;
line-height: 12pt;
margin: 0px 3px 3px 0px;
padding: 4px 10px;
background: none;
background-color: #0F004E;
color: #fefefe;
cursor: default;
float: left;
font-weight: bold;
}
li.token-input-highlighted-token-mac {
background-color: #231C34;
color: #fefefe;
font-weight: bold;
}
li.token-input-selected-token-mac {
background-color: #231C34;
color: #fefefe;
font-weight: bold;
}
li.token-input-highlighted-token-mac span.token-input-delete-token-mac {
color: #fefefe;
font-weight: bold;
}
li.token-input-selected-token-mac span.token-input-delete-token-mac {
color: #fefefe;
font-weight: bold;
}
li.token-input-input-token-mac {
border: none;
background: transparent;
float: left;
padding: 0;
margin: 0;
}
li.token-input-input-token-mac input {
width: 100px;
padding: 3px;
margin: 0;
}
div.token-input-dropdown-mac {
position: absolute;
border-top: none;
left: -1px;
right: -1px;
background-color: #fefefe;
overflow: hidden;
cursor: default;
font-size: 10pt;
}
div.token-input-dropdown-mac p {
font-size: 8pt;
margin: 0;
padding: 0 10px;
color: #fff;
}
div.token-input-dropdown-mac h3.token-input-dropdown-category-mac {
font-size: 10pt;
font-weight: bold;
border: none;
padding: 0 5px;
margin: 0;
}
div.token-input-dropdown-mac ul {
margin: 0;
padding: 0;
}
div.token-input-dropdown-mac ul li {
list-style-type: none;
cursor: pointer;
background: none;
background-color: #fefefe;
margin: 0;
padding: 0 0 0 10px;
color: #999;
text-transform: uppercase;
}
div.token-input-dropdown-mac ul li.token-input-dropdown-item-mac span.token-input-dropdown-item-description-mac {
float: right;
font-size: 8pt;
font-style: italic;
padding: 0 10px 0 0;
color: #999;
text-transform: uppercase;;
}
div.token-input-dropdown-mac ul li strong {
font-weight: bold;
text-decoration: underline;
color: #999;
text-transform: uppercase;
}
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac,
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac.odd {
background: #0F004E;
color: #bb8322; //Official Red
text-transform: uppercase;
font-weight: bold;
}
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac:hover,
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac.odd:hover,
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac:focus,
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac.odd:focus {
color: #fff;
}
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac span.token-input-dropdown-item-description-mac,
div.token-input-dropdown-mac ul li.token-input-selected-dropdown-item-mac.odd span.token-input-dropdown-item-description-mac {
color: #fff;
}
I have been trying to do something like this and have at least a rough version of something working, so I'll put this here in case it's useful. I used the Facebook theme - it looks like you used a different theme. I mention that because this influences things like class names in my answer. Also I think that Facebook might be more of what you're after (see the cosmetic stuff below).
I'll split this into two parts: a structural part first, and then a cosmetic part.
Structure
Part of my problem was due to the fact that the token input code replaces your HTML with some of its own. I wrote this HTML
<div id="searchBar">
<input type="text" id="bigTextInput" />
</div>
and the combination of the insert-token-input-here call:
$("#bigTextInput").tokenInput(token_url, {
theme: 'facebook',...
and the user entering a couple of things, made it look like this (with my comments):
<div id="searchBar">
<ul class="token-input-list-facebook">
<li class="token-input-token-facebook"> <!-- one of these per user input -->
<p>first thing the user entered
<span class="token-input-delete-token-facebook">X</span></p></li>
<li class="token-input-token-facebook">
<p>second thing the user entered
<span class="token-input-delete-token-facebook">X</span></p></li>
<li class="token-input-input-token-facebook"> <!-- 1 on the end for entering the next selection -->
<input id="token-input-Y"> <!-- Y = whatever Id you gave to the original input (bigTextInput in my case) -->
</li>
</ul>
<input id=Y display:none /> <!-- the thing you created, but then is hidden and replaced by the ul etc. -->
</div>
The input I created has been hidden away, and in its place there's now a ul, with an li per thing the user entered and an extra li for the user to add more things.
To change the height successfully I had to set the height I wanted on the ul:
$("ul.token-input-list-facebook").height(newHeight + "px");
Bonus structure stuff - auto-resizing
I started with just a large box, but this didn't look good if the user had entered only a small amount of stuff. So I thought I'd try to make it start small (a single line high) and then grow on demand.
To do this I made sure that the ul wouldn't create scrollbars:
ul.token-input-list-facebook {
overflow-x: hidden;
overflow-y: hidden;
}
and then if the content overflowed, I would re-size things. I checked for overflow by adding a handler to the add and delete events of the token input:
$("#bigTextInput").tokenInput(token_url, {
theme: 'facebook',
onAdd: function(){
growSearchBoxSizes();
},
onDelete: function(){
shrinkSearchBoxSizes();
}
});
The best way I found to detect overflow in growSearchBoxSizes was to compare the offsetHeight and scrollHeight properties of the enclosing div:
var heightA = parseFloat($("#searchBar")[0].offsetHeight);
var heightB = parseFloat($("#searchBar")[0].scrollHeight);
I suggest you write these to console.log, experiment with what they show when the input does and doesn't overflow, and have code to add 1 line's height when they show you that there is overflow.
I couldn't come up with a good way to detect when it was time to shrink (e.g. after the user had deleted a line's worth of stuff), so in the delete handler I shrink the box down to its starting size and then grow it back up to whatever height is needed, i.e. until there is no overflow. (A hack, but it seems to work.)
Actually, I was already using a handler for the add and delete events because of wanting to prevent what the user had already entered from showing up in the auto-completion list for later inputs, which you might want to also consider.
Cosmetic
The reason why I suggested that you might want to switch to the Facebook theme is that it has the X present all the time as you want. The colours and shapes aren't as you want them, but I hope that this should be a matter of just defining overrides in your CSS as appropriate.

Table Header in Google Charts loses background on scroll

I have a header row in a google chart with text wrapping (which i know is the issue with the new api removing it) that is losing the background color when the user scrolls down.
When i have text wrap off, the header row background persists, but the view becomes unpleasant to look at because the table is now so wide and requires a horizontal scroll bar.
this is a good example of the problem. you will see what happens when you scroll down the records in the resulting table
http://jsfiddle.net/asgallant/VTK3g/5/
is there some way to define the css to keep that header row with the background color? Or any other way outside of this construct?
.google-visualization-table-tr-head-nonstrict {
font-weight: bold !important;
text-align: left !important;
font-size: 12px !important;
width: 600px !important;
background-image: white !important;
}
.tableRowGoogle {
border: 1px solid #EEE;
padding-right: 3px;
padding-left: 3px;
padding-top: 2px;
padding-bottom: 2px;
border-width: 1px 0px;
}
.headercellgoogle {
padding: 6px;
width: 150px;
}
.rowcellgoogle {
border: 1px solid #EEE;
padding-right: 3px;
padding-left: 3px;
padding-top: 2px;
padding-bottom: 2px;
border-width: 1px 0px;
width: 100%;
}
.rowNumberCell {
border: 1px solid #EEE;
padding-right: 3px;
padding-left: 3px;
padding-top: 2px;
padding-bottom: 2px;
border-width: 1px 0px;
text-align: right;
width: 15px;
}
and before drawing:
var options=null;
if(data.getNumberOfRows()>7){
options = {
width : 600,
height:235,
sort : 'enable',
sortColumn : 1,
sortAscending : false,
scrollLeftStartPosition : 50,
showRowNumber : true,
chartArea : chartArea,
cssClassNames : cssClassNames
};
}else{
options = {
width : 600,
sort : 'enable',
sortColumn : 1,
sortAscending : false,
scrollLeftStartPosition : 50,
showRowNumber : true,
chartArea : chartArea,
cssClassNames : cssClassNames
};
}
I just stumbled across the answer.
adding background-color to
.headercellgoogle {
padding: 6px;
width: 150px;
background-color: blue !important;
}
within the css has fixed this issue

Is there a way to change "browse" in the file upload button? [duplicate]

This question already has answers here:
How to change the button text of <input type="file" />?
(23 answers)
Closed 7 years ago.
I'm not wanting to completely restyle the file upload button, I'd just like to change what the button says. Is there a way to do this?
Yes, you can customize using "label" tag and pseudo selector.
Plus: use javascript to display the filename.
http://jsbin.com/luruqo/5/edit?html,css,js,output
The base is:
/*Hide the current input file*/
input[type="file"] {
display: none;
}
/*Show the label as custom button*/
input[type="file"]+label[for] {
background-color: #0af;
color: #fff;
padding: 4px;
}
/*Prepare pseudoelement to display file selected (when input change set the title to label with js)*/
input[type="file"]+label[for]:after {
content: attr(title);
padding: 4px;
}
Here the complete snippet:
function filechange() {
var f = (this.files[0] || this.value);
document.getElementById('labelfor' + this.id).title =
(f.name || f.fileName || f.replace('C:\\fakepath\\', ''));
}
body {
font-family: arial;
}
.field input[type=file] {
display: none;
}
.field input[type=file] + label[for] {
font-size: 12px;
}
.field input[type=file] + label[for]:before {
content: attr(label);
border: solid 1px #0af;
padding: 3px 10px;
border-radius: 3px;
background-color: #def;
color: #555;
cursor: pointer;
box-shadow: none;
margin-right: 2px;
}
.field input[type=file] + label[for]:hover:before {
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.4);
color: #dfdfdf;
background-color: #0af;
}
.field input[type=file] + label[for]:active:before {
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.4);
color: #fff;
}
.field input[type=file] + label[for]:after {
padding: 3px 10px;
content: attr(title);
}
<div class="field">
<input type="file" id="file1" onchange="filechange.call(this,event);">
<label id="labelforfile1" for="file1" label="Select a file:"></label>
</div>

Resources