CSS Can't change input text background colour in chrome & bootstrap [closed] - css

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am trying to change the background-color of my input text and its not changing in chrome, it works in Safari but not chrome:
input {
background-color: red !important;
}
<form action="login.php?action=login" method="post">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="text" name="username" id="username" class="form-control" />
</div>
<div class="form-group">
<input type="password" name="password" id="password" class="form-control" />
</div>
<div class="form-group">
<input type="submit" name="submot" id="submit" class="btn btn-default" value="Login" />
</div>
</div>
</div>
</form>

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-box-shadow: 0 0 0 30px white inset !important;
}
and this to change color in autofill textbox:
input:-webkit-autofill {
-webkit-text-fill-color: yellow !important;
}

You can use jquery for this. Try this. This works and supports perfectly in all browsers.
$(document).ready(function(){
$(".test");});
Try the following example:
$(document).ready(function(){
//Method 01
$(".test");
//Method 02
//$(".test").css("background-color", "red");
});
.test{
background-color:#64b5f6; /* Your color */
color:#000;
border:none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" name="username" id="username" class="form-control test" />
Happy coding!

Related

Bootstrap 4 - Left aligning a large checkbox

Bootstrap 4.
<div class="form-group">
<label asp-for="Enabled" class="control-label"></label>
<input asp-for="Enabled" class="form-control" type="checkbox" />
<span asp-validation-for="Enabled" class="text-danger"></span>
</div>
I have a form (see image). I would like the check box to be underneath the word "Enabled" not centred like the other full width controls.
If I set "width: auto;" on the checkbox, this does the job, but then displays a small checkbox (I want a large one). See image.
<div class="form-group">
<label asp-for="Enabled" class="control-label"></label>
<input asp-for="Enabled" class="form-control" style="width: auto;" type="checkbox" />
<span asp-validation-for="Enabled" class="text-danger"></span>
</div>
My question is, how can I get a large left aligned checkbox on my form?
I am also searched before for the same issue, but not satisfied with the above answer that's why I have done my research and I found a good solution. Just add class "col-sm-1"
in the input tag, you are done.
<div class="col-8">
<input asp-for="IsUrgent" type="checkbox" class="form-control col-sm-1" />
<span asp-validation-for="IsUrgent" class="text-danger" />
</div>
you can also use like this if you are not satisfying with class name
input[type="checkbox"]{
width: 30px; /*Desired width*/
height: 30px; /*Desired height*/
cursor: pointer;
-webkit-appearance: none; /* if you want check inside box then remove this line*/
appearance: none; /* if you want check inside box then remove this line*/
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<form>
<div class="form-group">
<label asp-for="Enabled" class="control-label">Enabled</label>
<input asp-for="Enabled" class="form-control checkbox-large" type="checkbox" />
<span asp-validation-for="Enabled" class="text-danger"></span>
</div>
</form>
Its not tidy by setting an height and width for the checkbox should do the trick.
.checkbox-large {
width: 25px !important;
height: 25px
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<form>
<div class="form-group">
<label asp-for="Enabled" class="control-label">Enabled</label>
<input asp-for="Enabled" class="form-control checkbox-large" type="checkbox" />
<span asp-validation-for="Enabled" class="text-danger"></span>
</div>
</form>

Div stay during scroll. CSS [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to do div "Scroll" which stay in one place, even during scroll. Here's my code :
.Scroll {
position: fixed;
}
.Down {
clear: both;
}
<div class="container-fluid">
<div class="Scroll">
<div class="Down">
<div class="form-group">
<input type="text" class="form-control input-lg" placeholder="Search">
</div>
<div class="form-group" style="display:inline-block;width:300px;">
<h4><small>Select Date From <span class="glyphicon glyphicon-calendar"></span></small></h4>
<input type="date" class="form-control" style="width:250px;" class="form-control" />
<h4><small>Select Date To <span class="glyphicon glyphicon-calendar"></span></small> </h4>
<input type="date" class="form-control" style="width:250px;" class="form-control" />
</div>
</div>
</div>
</div>
<div class="Down">
<table>
<thead>
<tr>
<th>NAME</th>
<th>DATE</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="name in names">
<td>{{name.name}}</td>
<td>{{name.date}}</td>
</tr>
</tbody>
</table>
</div>
It doesn't work. Thanks for answers in advance!
Just add position:absolute instead of position:fixed like below:
.Scroll {
/*position: fixed;*/
position: absolute;
}
You need to have enough content to scroll or you're not going to be able to scroll.
The following css is what I used:
.Scroll {
display:block;
position: fixed;
top:100;
left:100;
background:#fff;
}
.Down {
clear: both;
}
See my jsfiddle:
https://jsfiddle.net/e63eyswp/1/

Problems making Bootstrap 3 more mobile friendly [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm creating a personal website using Twitter Bootstrap 3.4.3 for frontend and Python/Django 1.5.4 for backend. I'm currently having a lot of problems trying to get the website into a more mobile friendly mode. I'm using the cover and blog templates for my site. The cover template is the one that is being problematic.
Here is a snippet of the homepage of my website on a laptop-
And here is what it looks like on my smartphone -
Here's what the contact page looks like on my laptop -
And here's what it looks like on my smartphone -
As you can see in the mobile version, the background is not surrounding all elements and pictures and textboxes are not properly positioned.
I'm using the standard Twitter Bootstrap cover.css file for all the styling of the home page and contact page. Here is some example code I'm using for the main body -
html,
body {
height: 100%;
width: 100%;
background: url("../background-2.jpg") center no-repeat;
background-size:cover;
}
How can I change the styling to make my website mobile friendly?
The classes you apply to the form is what will matter before any custom CSS: .form-control. Bootstrap 3 Forms
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<form id="email_form" method="POST" action="/home/contact/">
<div class="row">
<input type='hidden' name='csrfmiddlewaretoken' value='uusHSjnOjeCLfyaCwmUC3eKH3EXIH9iX' />
<div class="col-md-6">
<div class="form-group">
<input id="id_name" maxlength="200" name="name" placeholder="Name" type="text" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input id="id_email" name="email" placeholder="E-mail" type="text" class="form-control" />
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<input id="id_subject" maxlength="100" name="subject" placeholder="Subject" type="text" class="form-control" />
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<textarea cols="40" id="id_message" name="message" placeholder="Message" rows="10" class="form-control"></textarea>
</div>
</div>
</div>
<button class="btn btn-primary" type="submit" name="send">Send</button>
</form>
</div>
You have two different stylesheets which are actually identical other then these rules (you really only need one file between these two):
cover.css has this rule and mobile.css is missing the height and width which is probably causing your problem with the background.
html, body {
height: 100%;
width: 100%;
background: url("http://www.raghavkumar.work/static/background-2.jpg") center no-repeat;
background-size:cover;
}
mobile.css has the this rule which cover.css does not.
.img-responsive {
display: block;
height: auto;
max-width: 100%;
}
Also, both have this error: bottom is misspelled. padding-bottom
.helptext {
padding-bottm: 2px;
font-size: 15px;
}

When using form-search and input-append to create a search form, the search button show up short

Here's the fiddle and code below:
<form class="form-search">
<div class="input-append">
<input type="text" id="search-query" class="search-query" />
<input type="button" id="search-submit" value="Find" class="btn" />
</div>
</form>
The button shows up fine in IE or Chrome, but when viewed with FF (ver 15 at least), the button show up a little short.
Am I not using the Bootstrap correctly?
From the doc, you should use button where you are using input:
<form class="form-search">
<div class="input-append">
<input type="text" id="search-query" class="search-query" />
<button type="button" id="search-submit" class="btn" >Find</button>
</div>
</form>
http://jsfiddle.net/tk8Dc/7/
Add height: auto; on the input textarea
Another good trait (just another tip)to use on input is:
box-sizing: border-box;
-webkitbox-sizing: border-box;
-moz-box-sizing: border-box;

Centering form in twitter-bootstrap? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm developing an open-source social-network for a student-group &etc.
I want this form to be centred on the page.
My attempt: http://jsfiddle.net/WgSgW/
How do I get it centred? - The closest I've gotten to a working solution is using the offset# classes.
Replace your form container, .span9 with .span12 to fully expand that row across the screen, then simply define your log in table as display:inline-block and text-align:center all the content of your form, like so:
Created my own classes to not mess around with the bootstrap's default values.
CSS
.login {
text-align:center;
}
.center {
*display:inline; /* ie 7 */
display:inline-block;
text-align:left; /* to reset the alignment to the left, container will remain centered */
zoom:1; /* ie7 junk */
}
HTML
<div class="container">
<div class="row">
<div class="span12 login">
<form action="" enctype="multipart/form-data" method="post">
<table class="center">
<tr id="auth_user_email__row">
<td class="w2p_fl"><label for="auth_user_email" id="auth_user_email__label" style="display:none;">Email: </label></td><td class="w2p_fw">
<input class="string" id="auth_user_email" name="email" placeholder="email address" type="text" value="" />
</td><td class="w2p_fc"></td>
</tr>
<tr id="auth_user_password__row">
<td class="w2p_fl"><label for="auth_user_password" id="auth_user_password__label" style="display:none;">Password: </label></td><td class="w2p_fw">
<input class="password" id="auth_user_password" name="password" placeholder="password" type="password" value="" />
</td><td class="w2p_fc"></td>
</tr>
<tr id="submit_record__row">
<td class="w2p_fl"></td><td class="w2p_fw">
<input class="btn btn-large btn-primary" type="submit" value="Signup" />
</td><td class="w2p_fc"></td>
</tr>
</table>
</form>
</div>
</div>
<div class="pagination-centered">
By signing up you are agreeing to our terms & conditions
</div>
</div>
Demo: http://jsfiddle.net/WgSgW/1/
The native way for positioning elements in Twitter Bootstrap is using offset# classes. For your particular case, you can use
<div class="span4 offset4"> ... </div>
Taje a look here
The form is already centered. What you need to do is center the table by applying style margin:0 auto;
this should work.

Resources