Bootstrap span inside a span - css

I have some difficulties to understand how put span inside span with bootstrap.
I want to have one block centered, with inside :
-One row with inside :
-One block at left (span6)
-One block at right (span6)
-One row with inside :
-One button centered (span 6 offset3)
You could see the problem here :
http://jsfiddle.net/UBTv4/18/
<div class='row'>
<div class='span6 offset3'>
<div class='well'>
<h2>Title</h2>
<div class='row'>
<div class='span6'>
<p class="lead">Bloc left : </p>
</div>
<div class='span6'>
<p class="lead">Bloc right : </p>
</div>
</div>
<div class='row'>
<div class='span6 offset3'>
<input id="play" type="submit" value="play" class="btn btn-primary"/>
</div>
</div>
</div>
</div>
What is the problem ?
I want something like that :

Here is your solution.
<div class='row'>
<div class='span6 offset3 well' > <!-- .well class here instead of inner div -->
<h2>Title</h2>
<div class='row'>
<div class='span3'> <!-- instead of span6 -->
<p class="lead">Bloc left : </p>
</div>
<div class='span3'> <!-- instead of span6 -->
<p class="lead">Bloc right : </p>
</div>
</div>
<div class='row'>
<div class='span3 offset3'> <!-- instead of span6 -->
<input id="play" type="submit" value="play" class="btn btn-primary"/>
</div>
</div>
</div>
</div>
http://jsfiddle.net/UBTv4/23/
As explanation I'll suggest you to carefully read Nesting column section from this link:
http://getbootstrap.com/2.3.2/scaffolding.html
In short description, if you nest row in a span6, the sum of inner row spans should be 6 also (3+3).
Also .well class has some paddings/marings, so you can't you it "between" parent and nested rows/spans.

I think you want to use .row-fluid instead. This will get your 2 .span6 is one row.
Here is the updated fiddle: http://jsfiddle.net/skelly/UBTv4/22/

You could also use pull-right and pull-left to make the respective blocks move left and right.
</div>
<div class='span6'>
<p class="lead pull-right">Bloc right : </p>
</div>
</div>
<div class='row'>
<div class='span6 offset3'>
<input id="play" type="submit" value="play" class="btn btn-primary"/>
</div>
</div>
</div>
</div>
You can see the code here:http://jsfiddle.net/UBTv4/18/

Related

How do I vertically align elements inside a centered column, using Bulma?

How do I vertically align elements inside a centered column using Bulma?
current results:
My code:
<template>
<div id="dataFetcher" class="box">
<h1 class="block">Data Fetcher</h1>
<div class="columns is-vcentered is-centered">
<div id="123" class="column has-background-success is-half">
<input type="text" class="">
<button type="button" :class="{ 'is-loading': isLoading } " class="block button is-vcentered" #click="fetchData">Fetch data</button>
</div>
</div>
</div>
</template>
Thinking:
I've used a .columns .is-centered div to center horizontally. Check.
But for vertical alignment, .columns .is-vcentered isn't the answer because it requires two separate columns (which feels like the wrong approach to me?).
Other references I've seen imply using .is-flex .is-align-items-center to get some Flexbox action going, but putting that on or inside the column div breaks the horizontal alignment from .columns.
It helps if the text input has a class of input, then I would put the fields into a horizontal field container:
<template>
<div id="dataFetcher" class="box">
<h1 class="block">Data Fetcher</h1>
<div class="columns is-vcentered is-centered">
<div id="123" class="column has-background-success is-narrow">
<div class="field is-horizontal">
<div class="field-body">
<div class="field">
<p class="control">
<input type="text" class="input">
</p>
</div>
<div class="field">
<p class="control">
<button type="button" class="button">Fetch data</button>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</template>

Centering a div horizontally

I must be missing something really simple here:
<div class="row">
<div class="col-lg-12">
<a href="/add" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add User
</a>
</div>
</div>
<div class="row">
<div class="col-lg-12" ng-show="users.busy">
<div class="spinner-loader center-block"></div>
</div>
</div>
I've used the bootstrap classes, including center-block. Yet it always looks like this:
Why isn't the spinner icon in the centre of the page?
There is a work around to your problem by changing some HTML as follows
<div class="row">
<div class="col-lg-12 text-center" ng-show="users.busy">
<span class="spinner-loader">Loading</span>
</div>
</div>
instead of <div> for spinner I took a <span> which will be centered horizontally because of text-center class to parent <div>.
You can try this:
<div class="row">
<div class="col-lg-12">
<a href="/add" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add User
</a>
</div>
</div>
<center>
<div class="row">
<div class="col-lg-12" ng-show="users.busy">
<div class="spinner-loader"></div>
</div>
</div>
</center>
Instead of using center-block, add text-center class
I ve been using the bootstrap col-md-offset css to center my divs. For example:
<div class=container>
<div class=row>
<div class=form-horizontal>
<div class="col-md-offset-4 col-md-4">
<div class="your div">
</div>
</div>
</div>
</div>
Your div will be responsive, thus as you resize the window the div will remain in the center of the window.

Grids in box bootstrap

I'm trying to bulid grids like the photo below
IMG LINK: http://postimg.org/image/qo3b4nof1/
But i'm getting the DIV E in almost next to the D-DIV
here's my code
<div class="container">
<div class="row">
<div class="col-md-1">
<div class="col-md-1">A</div><br/>
<div class="col-md-1">B</div><br/>
<div class="col-md-1">C</div>
</div>
<div class="col-md-11">D<br/>
<div class="col-md-1">E</div>
</div>
</div>
</div>
The break-lines i added because DIV-A and DIV-B become one piece without breaklines.
is it better to do it with table ?
You do not need to use container and row with bootstrap 3.*
I changed you code to match the provided screenshot, see this http://jsfiddle.net/Sd2zw/ .
I just use xs columns because the small screen of jsfiddle, you can replace it back by md :
<div>
<div class="col-xs-1">
<div class="col-xs-12">A</div>
<div class="col-xs-12">B</div>
<div class="col-xs-12">C</div>
<span class="clearfix"></span>
</div>
<div class="col-xs-11">
<div class="col-xs-12 d-container">D</div>
<div class="col-xs-12">
<div class="col-xs-1">E</div>
<span class="clearfix"></span>
</div>
</div>
<span class="clearfix"></span>
</div>
Also, use some clearfix tags to clear the float.

Sections invisible until window resize

I cant get sections to work properly, they are invisible until a window resize.
foundation.css:2413 code at this line setting section-container to visibility:hidden
I copied the actual code but even examples doesnt work in that containing divs.
<div class="large-8 columns large-centered">
<form class="custom ajaxform" data-validate="parsley" method="post" action="formProcess">
<input type="hidden" name="formtype" value="test" >
<fieldset>
<legend>Test</legend>
<span class="icon24 icon-close"></span>
<h4><small>Test</small></h4>
<?= View::make('forms.header') ?>
<h4><small>Test</small></h4>
<div class="section-container tabs" data-section="tabs">
<section class="active">
<p class="title" data-section-title>Test</p>
<div class="content" data-section-content>
<div class="row">
<div class="large-4 columns">
<label>Test *</label>
<input type="text" name="test" data-required="true">
</div>
</div>
</div>
</section>
<section>
<p class="title" data-section-title>test Tab 2</p>
<div class="content" data-section-content>
<div class="row">
<div class="large-6 columns">
<label>Second *</label>
<input type="text" name="second" data-required="true">
</div>
</div>
</div>
</section>
</div>
<div class="row">
<div class="large-12 columns">
<button class="small radius button" style="float:right" type="submit">Submit</button>
</div>
</div>
</fieldset>
</form>
</div>
Probably because you were adding the sections programmatically. In that case, you need to force a resize, so that foundation will be triggered to draw them correctly.
I had the same problem, and after quick googling, this would solve it:
$('[data-section]').trigger('resize');
If a
<div>
is not visible then it may means that it doesn't have a well defines height and width. Then rendering a content is not meaningful. To avoid that flaw we have to add a height and width.
<div class="section-container tabs" data-section="tabs" style="height: 400px; width : 400px;"></div>
Mention your respective height and width.

How to make a column stretch to fill container div (while being responsive)

I'm using Twitter Bootstrap (latest version - 2.3.2) for a site I'm building, and want to achieve the following while keeping the site responsive, and also applying best practices for it.
Here's a very rough sketch of what I want to have:
The site has a basic header with fixed navbar, a content-fluid div which has three inner divs: a span5, span6, and span1 (for a total of 12 columns). After the content div, a sticky footer with company/copyright info and such.
The problem I'm having is with the span1 column. It is basically decorative (it has 4 vertical color bars, sized at 25% width each), but I'd like to have:
Social link icons vertically-centered in the column (Twitter, Facebook, LinkedIn, etc), as shown by the black boxes.
Text rotated 90 degrees counter-clockwise inside each colored bar. It's only one word each, and is not a priority.
Each bar stretching to fill the full height of the parent container (in this case, the content div), since the height of the page is currently set by the highest div, whether it's span5 or span6.
I know there are probably lots of ways to achieve this (pure CSS, javascript, background-image tiling), but I'm looking for the best practices: avoiding extra markup, using right techniques, in order to learn as much as possible. I've tried setting the parent container (and inner bars) to height: 100%; and playing with min-height as well, but min-height doesn't (seem to) work with percentages.
Any help and/or constructive criticism is very welcome.
Edit: JSFiddle and full code added: JSFiddle
Also, link to the original site (in case JSFiddle screws something up): Original page
<!-- Part 1: Wrap all page content here -->
<div id="wrap">
<!-- Fixed navbar -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button> <a class="brand" href="#">Geología y Telecomunicaciones, C.A.</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li>Inicio
</li>
<li>Acerca de
</li>
<li class="active">Contacto
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div>
<div class="decorative-lightblue"></div>
<div class="decorative-purple"></div>
<div class="decorative-orange"></div>
<div class="decorative-lightorange"></div>
</div>
</div>
<!-- Begin page content -->
<div class="container-fluid">
<div class="row-fluid content clearfix" style="margin-top: 60px;">
<div class="span5">
<div class="row-fluid">
<div class="span5">
<div class="span12 logo"></div>
<div class="sidebar-intro">Construcción, Adaptación,
<br/>Adecuación y Remodelación
<br/>de <span class="emphasis-red">
locales<br>comerciales<br>empresariales
</span>
</div>
</div>
<div class="span7">
<!-- Responsive iFrame -->
<div class="Flexible-container">
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&ll=8.561755,-71.204721&spn=0.004716,0.006571&t=m&z=18&output=embed"></iframe>
<br /><small>Ver mapa más grande</small>
</div>
</div>
</div>
<div class="row-fluid">
<div class="contact-wrapper well">
<form>
<div class="control-group">
<label class="control-label" for="inputName"><i class="icon-user"></i> Nombre</label>
<div class="controls controls-row">
<input type="text" class="span12 input-xlarge " id="inputName" placeholder="Su nombre completo">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail"><i class="icon-envelope"></i> Correo electrónico</label>
<div class="controls">
<input type="text" class="span12 input-xlarge" id="inputEmail" placeholder="nombre#sudominio.com">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail"><i class="icon-question-sign"></i> Asunto</label>
<div class="controls">
<input type="text" class="span12 input-xlarge" id="inputSubject" placeholder="Asunto de su mensaje">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail"><i class="icon-pencil"></i> Mensaje</label>
<div class="controls">
<textarea rows="6" class="span12 input-xlarge" placeholder="Haganos llegar sus comentarios, sugerencias, consultas, etc."></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-success">Enviar Mensaje</button>
</div>
<br class="clear">
</div>
</form>
</div>
</div>
</div>
<div class="span6">
<div class="row-fluid span12">
<img class="span9 offset2" src="http://geotelca.com/sitio/assets/img/examples/flyer_back.png">
</div>
<div class="row-fluid">
<div class="row-fluid span12 address"> <address>
Zona Industrial Los Curos, Calle 1, Edif. Geotelca No. A-8, Mérida, Edo. Mérida
</address>
</div>
<div class="row-fluid e-mail">
<div class="span4 offset6"> direccion#geotelca.com
</div>
</div>
</div>
</div>
<div class="span1 social-links">
<div class="row-fluid vertical-bars">
<div class="span3 bar bar-lightblue"></div>
<div class="span3 bar bar-purple"></div>
<div class="span3 bar bar-orange"></div>
<div class="span3 bar bar-lightorange"></div>
</div>
</div>
</div>
</div>
<!--/.container-fluid-->
<div id="push"></div>
</div>
<!--/#wrap-->
<div id="footer">
<div>
<div class="decorative-lightblue"></div>
<div class="decorative-purple"></div>
<div class="decorative-orange"></div>
<div class="decorative-lightorange"></div>
</div>
<div class="container">
<p class="muted credit">Diseñado, codificado y mantenido por #kenshin23
</p>
</div>
</div>
I would say your best bet here would be one of the jQuery plug-in out there to accomplish this ... eqHeight.coffee seems to be pretty well documented:
https://github.com/jsliang/eqHeight.coffee/
As for centering those social links in that vertical space, you'd likely have to use more Javascript to do that. Although, honestly I'd probably put them in a div container with position: fixed; and let them slide up and down that column as the user scrolls.
EDIT:
Just noticed you added your HTML file ... in the case of the first plug-in I linked to, you would need to add a class (perhaps 'eq-height') to each of the columns whose heights you wanted to match (that first outer span5 and span6 and then all the bar column divs individually). Then on jQuery document ready, use:
$(document).ready(function() {
$(".content").eqHeight(".eq-height");
});

Resources