Bootstrap rendering inconsistency - html

I have a rendering inconsistency between Chrome (correct) and Firefox (incorrect) when using Bootstrap. This is my code (fiddle here):
<div class='container'>
<form class='form-horizontal well span6 offset3'>
<label class='control-label'>Testy</label>
<div class='controls'>
<select></select>
</div>
</form>
<legend>Hello!</legend>
</div>
What is the cause of the inconsistency? How can I fix the Firefox rendering so that it matches Chrome's?

It appears to be the way that Firefox and Chrome render the fieldset tag, at least with the non-responsive version of Bootstrap you're referencing. In an effort to eliminate variables, I removed the reference to Bootstrap and linked to bootstrapcdn.com's version, which seemes to fix the problem.
If nothing else, you could always add a bit of CSS to the fieldset tag to ensure it renders the same across all modern browsers.
fieldset { clear: both; }
Update: Looks like I was not paying attention, I've updated this answer to reflect CSS on the legend tag, rather than fieldset. JSFiddle Here.
legend { clear: both; }

The legend tag should be placed within the form tag and it should also have a fieldset tag placed around it.
See this example from Bootstrap:
<form>
<fieldset>
<legend>Legend</legend>
<label>Label name</label>
<input type="text" placeholder="Type something…">
<span class="help-block">Example block-level help text here.</span>
<label class="checkbox">
<input type="checkbox"> Check me out
</label>
<button type="submit" class="btn">Submit</button>
</fieldset>
</form>
And for your code it would be:
<div class='container'>
<form class='form-horizontal well span6 offset3'>
<fieldset>
<label class='control-label'>Testy</label>
<div class='controls'>
<select></select>
</div>
<legend>Hello!</legend>
</fieldset>
</form>
</div>

Related

Firefox input goes out of the box

The problem is probably related to bootstrap itself. When the input is wrapped into col-* class and is part of the .form-inline group, it goes out of the box.
Here is a quick test case:
<div class="form-inline row">
<div class="col-sm-8">
</div>
<div class="col-sm-2 text-center">
<input class="form-control" id="qty-0" max="100" maxlength="3" min="1" value="1" type="number">
</div>
<div class="col-sm-2">
<span>Some text</span>
</div>
</div>
I've also created a fiddle.
Please note: I am not looking for the fixes as it can be fixed by adding width: 100% as in this example.
Is this a bug in Firefox or expected behaviour?
EDIT: here is how the input appears
EDIT 2: to avoid confusion of wrongly used bootstrap classes here is another example
EDIT 3: none bootstrap example replicating the problem
Add this to your CSS:
input,
select {
max-width: 100%;
}
Hope it will help!
Try this
<div class="row">
<div class="col-sm-2"><input class="form-control" id="qty-0" max="100" maxlength="3" min="1" value="1" type="number"></div>
<div class="col-sm-2"><span>Some text</span></div>
</div>
Edited:
Looking at your code, you are using form-inline, you can remove that part does not go with row for bootstrap as it is not compatible when using firefox or IE

Standardized way of graying out normal HTML text

Is there a standardized way of graying (greying) out text that is meant to be ignored, either in HTML, or bootstrap?
I tried looking at both how Slack styles the "(edited)" text, and how Twitter itself (twitter.com) styles timestamps, and it seems they just change the font color. It just seems strange to me that an arbitrary font color is chosen without any semantic information is attached to it, or even a standardized shade of gray.
The bootstrap documentation mentions some semantic colors, but gray isn't included in them - gray is only mentioned in grayscale.
There is actually a standard way to do it, in bootstrap, which is to use to use text-muted.
In fact, there is a list of standard text shades and colors that are applied directly.
http://www.w3schools.com/bootstrap/bootstrap_ref_css_helpers.asp
As for HTML, having a CSS with a disabled class and applying that to any of your text would be a better option.
Standard HTML Input Forms
An example of this is disabling HTML input elements, though there's not a standard display of that across browsers.
http://codepen.io/anthonyastige/pen/dXNEmx
<input type=button value="I can do all the things">
<input type=button value="I'm disabled" disabled>
Bootstrap Input Forms
There's also the concept of disabling input elements here with the .disabled class
https://getbootstrap.com/css/#checkboxes-and-radios
Bootstrap text
The .text-muted class implies disabled, though the specs don't say exactly what it means.
https://getbootstrap.com/css/#helper-classes
See samples below:
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<fieldset disabled>
<div class="form-group">
<label for="inputText">Disabled input</label>
<input class="form-control" id="inputText" type="text" placeholder="Disabled Input" disabled>
<p class="help-block">Example block-level help-block class text here.</p>
<p class="text-muted">Example block-level with text-muted class.</p>
</div>
<div class="form-group">
<label for="optionSelect">Disabled select menu</label>
<select id="optionSelect" class="form-control">
<option>Select Value</option>
</select>
</div>
<div class="checkbox">
<label>
<input type="checkbox">Disabled Checkbox
</label>
</div>
<button type="submit" class="btn btn-primary">Disabled Button</button>
</fieldset>

How to make the input full-length in a column in Bootstrap?

Bootply codes can be seen here => http://www.bootply.com/QpvisrtAJR
I want the input box to be longer, however, the width:100% doesn't work for it.. And I don't want to use width: xxxpx or size=xxx to make it longer because it will be un-responsive in different resolution..
Does anyone have ideas about this?
Your input rule isn't actually being applied. It is not specific enough so is being overwritten by a default bootstrap rule. Try this instead:
.form-inline button.form-control,
#contain_word
{
display: block;
width: 100%;
}
http://www.bootply.com/Qh2VwydnHx
Also you have a an erroneous character in your html where you give the input field an id. Should be:
<input type="email" class="form-control" id="contain_word">
Not:
<input type="email" class="form-control" id="contain_word`">
You can use the calc() method to have the input field 100% in width but still float left to the label.
Updated Bootply: http://www.bootply.com/2K3ZIWsuWy
Calc() is compatible with most browsers except Opera Mini. For Blackberry you still need -webkit.
Check out the compatibility table here: http://caniuse.com/calc
You can add your class with a specified width
or override existing styles, but it is better to create your own style file
http://www.bootply.com/QpvisrtAJR#
div class="row">
<form class="form-inline" role="form">
<div class="form-group col-sm-6 no-padding">
<label for="contain_word`">Containing word(s): </label>
<input class="form-control test" id="contain_word`" type="email">
</div>
<div class="col-sm-2">
<button class="btn btn-primary form-control">Search</button>
</div>
<div class="col-sm-2">
<button class="btn btn-primary form-control">Clear</button>
</div>
</form>
</div>

align <span> between two <input> elements

ISSUE
Using twitter bootstrap 2.3.2 there is an issue that can be seen below.
HTML:
<body>
<div class="container">
<input class="span5" type="text" id="1" />
<span class="span3">...</span>
<input class="span4" type="text" id="2" />
</div>
</body>
To me this should make an input textbox, then ... then another input textbox...however, with bootstrap it makes ... then an input, then another input.
Examples
Example of Error: jsFiddle
Expected Result: jsFiddle
The span classes you are using on the the inputs and ellipsis elements are block elements and are used with Bootstraps grid system to layout your content.
See: http://getbootstrap.com/css/#grid
Solution
Adding the style float:left resolved the weird issue due to span auto adding this float.
HTML
<body>
<div class="container">
<input style="float:left;" class="span5" type="text" id="1" />
<span class="span3">...</span>
<input style="float:left;" class="span4" type="text" id="2" />
</div>
</body>
Demo: jsFiddle

HTML form textarea problem

In my html form the word message is showing at the bottom-left of the textarea, How can I adjust it on the top-left of textarea? img - http://img641.imageshack.us/img641/415/htms.jpg
<form name="reg_form" method="post" action="home.php">
First Name:
<input type="text" name="f_name"/><br/> <br/>
Last Name:
<input type="text" name="l_name"/><br/> <br/>
Your Email:
<input type="text" name="new_email"/><br/> <br/>
Re-enter Email: <input type="text" name="check_email"/><br/> <br/>
Message: <textarea cols="30" rows="10" name="message"></textarea>
</form>
You'll need to use a <label> tag to put your, well, labels in. Then using some CSS you can align it to the top of the <textarea> using this:
label
{
display: inline;
vertical-align: top;
}
HTML:
<form>
<label>Message:</label>
<textarea></textarea>
</form>
There's a live example I made here.
In other news
Your technique of spacing the inputs using isn't the best. For one, different fonts have different space widths and secondly, it makes your code look rubbish. You can get around this by using <label>s with CSS inline-block. There's a working example here.