Align Spans using Bootstrap - html

I am working on a webpage that displays the users' personal information, and I would like to align vertically the spans colored in red using Bootstrap.
The following is a screenshot of my form:
and here is the HTML/CSS code I am using:
HTML
<table class="table">
<tbody>
<div class="col-sm-6 test">
<span class=""><strong >First Name: </strong></span>
<span class="" style="color:red" >FirstName</span>
</div>
<div class="col-sm-6 test">
<strong class="">Age: </strong>
<span class="" style="color:red">Age</span>
</div>
<div class="col-sm-6 test">
<strong class="">Last Name: </strong>
<span class="" style="color:red">LastName</span>
</div>
<div class="col-sm-6 test" >
<strong class="">Status: </strong>
<span class="" style="color:red">Status</span>
</div>
</tbody>
</table>
CSS
.test{
border-top: 1px solid #e2eae9; vertical-align: middle; padding: 6px 8px;
}

You can try using display table-row and display table-cell
Result: jsfiddle
.test{
border-top: 1px solid #e2eae9; vertical-align: middle; padding: 6px 8px;
display: table-row;
}
Result: jsfiddle
.test span{
display: table-cell;
}
Alternatively using bootstrap, you can make your test div as rows and your span as columns:
<div class="row test">
<span class="col-sm-6"><strong >First Name: </strong></span>
<span class="col-sm-6" style="color:red" >FirstName</span>
</div>

If you mean to stack the red text under the "labels" then you could do something like this:
<table class="table">
<tbody>
<div class="col-sm-6 test">
<span class="col-sm-12"><strong >First Name: </strong></span>
<span class="col-sm-12" style="color:red" >FirstName</span>
</div>
<div class="col-sm-6 test">
<strong class="col-sm-12">Age: </strong>
<span class="col-sm-12" style="color:red">Age</span>
</div>
<div class="col-sm-6 test">
<strong class="col-sm-12">Last Name: </strong>
<span class="col-sm-12" style="color:red">LastName</span>
</div>
<div class="col-sm-6 test" >
<strong class="col-sm-12">Status: </strong>
<span class="col-sm-12" style="color:red">Status</span>
</div>
</tbody>
</table>

Related

Background color does not fill entire div

I have a div that is a panel, and I want to apply to the body a black background color, when I do that it left around 100 px white space
I think that happens because in my css I defined
.Stock{
min-height:600px;
height:600px;
}
but I want the div to be that big it matches the perfect size, if I cut this css the size changes, I want to maintain the size and have that white space filled, how can I do that ?
here is the html of the specific div
<div class="panel panel-default Stock">
<div class="panel-heading panel-heading-custom clearfix">
<div>
Controlo de stock
<div class="pull-right">
<img alt="" class="warningImg" height="20" src="../warning.png" width="20">
</div>
<div class="pull-right">
<h4 id="numberWarnings"></h4>
</div>
</div>
</div>
<div class="panel-body ProdutosTodos">
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeIceTea"></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeCroissant"></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeKitKat"></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeKinderBueno"></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeWatter"></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeBubbleGums"></p><a class="editar" href="#">editar</a> eliminar
</div>
<div class="col-md-6 SeccaoProduto">
<p class="productName"></p>
<p>Quantidade Atual: <span class="quantidadeProduto"></span></p>
<p id="quantidadeCheaps"></p><a class="editar" href="#">editar</a> eliminar
</div>
</div>
<form action="" class="form-horizontal" id="formularioEdicao" name="formularioEdicao">
<div class="col-md-offset-1">
<span class="glyphicon glyphicon-arrow-left"></span>
</div>
<div class="form-group">
<label class="control-label col-md-offset-1 col-md-2" for="">Produto</label>
<div class="col-md-8">
<input class="form-control" id="EditarNomeProduto" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-offset-1 col-md-2" for="">Quantidade</label>
<div class="col-md-offset-1 col-md-6">
<input class="sliderProducts" type="range">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button class="btn btn-default" id="GuardarEdicao">Guardar</button>
</div>
</div>
</form>
</div>
The issue you are running into is coming from .panel in panels.less:
.panel {
margin-bottom: 20px; // <-- Your background-color will not fill 100%
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
The image you have shown does not look like 100px. Try setting margin-bottom: 0;.
Use this CSS. It will fix your problem:
.panel {
background: black;
margin-bottom: 0px;
min-height: 600px;
height: 700px;
}
You don't have to make the min-height and the height the same. Try this:
.Stock {
min-height: 600px;
height: 100%;
}
or maybe:
.Stock {
min-height: 600px;
height: 700px;
}

I want to remove the flickering effect above the image on hover

I have to display a list of products and on hover show some additional information. But on hover, it is flickering a lot. I am not able to understand how to remove that. Any help will be appreciated to remove flickering a lot on hover.
.fixed-width-200 {
width: 200px;
}
.img-responsiveExtended {
display: block;
height: 550px;
max-width: 100%;
overflow: hidden;
text-align: center;
vertical-align: central;
padding-top: 20px;
margin: 0 auto;
}
.parentContent {
position: relative;
/*border:outset;
border-width:thin;
margin:0px;*/
}
.contentWithMargin {
padding: 20px;
height: 200px;
position: absolute;
bottom:150px;
z-index: 1;
background-color:antiquewhite;
opacity:0.8;
}
.imageContentStyle {
z-index: 0;
float:left;
}
.columnBorder {
border: outset;
}
.divWithCenterImgStyle {
text-align:center;
}
.dealPriceStyle {
font-size: 24px;
}
<!DOCTYPE html>
<html>
<head>
<title>
</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 parentContent" id="parentDiv">
<div class="imageContentStyle">
<div>
<div class="row">
<div class="divWithCenterImgStyle">
<center>
<img class=
"img-responsiveExtended img-container" src=
"http://ecx.images-amazon.com/images/I/A15JTuUMDOL._UY679_.jpg">
</center>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div style="text-align:right">
<strike>
</strike>
<span class=
"dealPriceStyle">
<mark>
<label>$
</label>58.00
</mark>
</span>
</div>
</div>
</div>
</div>
<div>
<h5>Calvin Klein Women's Two-Color Fringe Scarf
<small>
<a href=
"/DreamsNDeals/Home/DealsByVendor?vendorId=1">Amazon
</a>
</small>
</h5>
</div>
</div>
<div class="contentWithMargin collapse" id="38">
<div>
<div class="row modal-body">
<h6>
<span class="label label-warning">
<span class=
"glyphicon glyphicon-time">
</span>
</span>
</h6>
<h5>
<small>
</small>
</h5>
<!-- this text is coming as a flickering effect -->
<p class="text-primary">100% Acrylic Imported
Machine Wash 16" wide Color-blocked scarf with
fringe trim Made in China
</p>
<p class="text-info">Free Shipping
</p>
<div class="col-xs-6">
<p>
<a class="btn btn-primary" href=
"http://www.amazon.com/gp/product/B00Z69JVR8/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00Z69JVR8&linkCode=as2&tag=dreamsndeal02-20&linkId=CAQNU4JFUUNNWPUB"
target="_blank">Get Deal ยป
</a>
</p>
</div>
<div class="col-xs-6">
<p class="text-primary">
</p>
</div>
</div>
</div>
</div>
</div>
</div>.
</div>
</body>
</html>
You can see the main HTML code and the CSS code as above.

How to make the pull-left/pull-right inside cause it goes outside

I've style border: 1px solid black; to determine if it is correct box, but it overlap and goes outside. This is my html
<div class="panel panel-default">
<div class="panel-body">This page is temporarily disabled by the site administrator for some reason.</div>
<div class="panel-footer clearfix">
<p>Drink whaterver jklasd jklasd jklnxm,c kasdk jj jjjjs lasd jklasd m,zxc asd kljaskd kljasd kl</p>
<div style="border: 1px solid black; display: block;" class="pull-left">
<div class="row">
<p>By Jerald Patalinghug</p>
</div>
<div class="row">
Tags: Funny, Wtf, Nice
</div>
</div>
<div style="border: 1px solid black;" class="pull-right">
<div id="votes">
<div class="row">
<a href="#" data-card_id="26" class="vote upvote btn btn-default">
<span class="fa fa-thumbs-up"></span>
</a>
<a href="#" data-card_id="26" class="vote downvote btn btn-default">
<span class="fa fa-thumbs-down"></span>
</a>
</div>
<div class="row">
<center>
<span class="vote_count">1</span> points
</center>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
and this is the image
look, the inside of div.pull-left are going outside.
EDIT1
Thanks guys, What I did was remove class="row" on every div
<div class="panel panel-default">
<div class="panel-body">This page is temporarily disabled by the site administrator for some reason.</div>
<div class="panel-footer clearfix">
<p>Drink whaterver jklasd jklasd jklnxm,c kasdk jj jjjjs lasd jklasd m,zxc asd kljaskd kljasd kl</p>
<div style="border: 1px solid black; display: block;" class="pull-left">
<div>
<p>By Jerald Patalinghug</p>
</div>
<div>
Tags: Funny, Wtf, Nice
</div>
</div>
<div style="border: 1px solid black;" class="pull-right">
<div id="votes">
<div>
<a href="#" data-card_id="26" class="vote upvote btn btn-default">
<span class="fa fa-thumbs-up"></span>
</a>
<a href="#" data-card_id="26" class="vote downvote btn btn-default">
<span class="fa fa-thumbs-down"></span>
</a>
</div>
<div>
<center>
<span class="vote_count">1</span> points
</center>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
Remove the
<div class="row">
inside each of the bordered div's - these are adding -15px to the left and right. These are only to be used when you are nesting inside .container or .col-sm-12 (for example).
This is a good read if you're not 100% sure on how the bootstrap grid works:
http://www.helloerik.com/the-subtle-magic-behind-why-the-bootstrap-3-grid-works
Use class container-fluid along with pull-left/pull-right.
Solution:
<div class="panel panel-default">
<div class="panel-body">This page is temporarily disabled by the site administrator for some reason.</div>
<div class="panel-footer clearfix">
<p>Drink whaterver jklasd jklasd jklnxm,c kasdk jj jjjjs lasd jklasd m,zxc asd kljaskd kljasd kl</p>
<div style="border: 1px solid black; display: block;" class="pull-left container-fluid">
<div class="row">
<p>By Jerald Patalinghug</p>
</div>
<div class="row">
Tags: Funny, Wtf, Nice
</div>
</div>
<div style="border: 1px solid black;" class="pull-right container-fluid">
<div id="votes">
<div class="row">
<a href="#" data-card_id="26" class="vote upvote btn btn-default">
<span class="fa fa-thumbs-up"></span>
</a>
<a href="#" data-card_id="26" class="vote downvote btn btn-default">
<span class="fa fa-thumbs-down"></span>
</a>
</div>
<div class="row">
<center>
<span class="vote_count">1</span> points
</center>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
Apply padding in style to have nice look
<div style="border: 1px solid black;padding: 2%; display: block;" class="pull-left container-fluid">
<div style="border: 1px solid black;padding: 2%" class="pull-right container-fluid">

Positioning divs like table cells and rows

I am trying to make a little game to learn some javascript.
Ok, so I was using untill now a table for my content (image):
Now, what I am trying to do, is to use divs instead of table. But I want to position them to look similar to the image above.
This is what i have now:
My code for the Lemonade stand div (its similar for the others):
<div style="background: url(images/texture.png); display: table; margin-left: auto; margin-right:auto; border: solid black 2px; padding: 10px">
<div style="padding-bottom: 7px"><b><center>Lemonade stand</center></b></div>
<div style="padding-bottom: 7px"><center><button id="countButton" style="padding: 2px;"><img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px"></button></center></div>
<div><b><font color="brown">Level:</font></b> <span id="displayLevel"> 1 </span> <img src="images/plus.png" id="buyLevel" width="20px" height="18px"></div>
<div><b><font color="green">Production:</font></b> <span id="production"> 1 </span> $ </div>
<div> <font style="font-size: 15px">(Prod. per click) </font> </div>
<div><b><font color="red">Level price:</font></b> <span id="pretlevel"> 0 </span> $ </div>
</div>
I am beginner, trying to learn. Thanks!
div will like as table if you add next styles:
display:table; to div table-analog
display:table-row; to div tr-analog
display:table-cell; to div td-analog;
<div style="display: table;">
<div style="display: table-row;">
<div style="background: url(images/texture.png); display: table-cell; margin-left: auto; margin-right:auto; border: solid black 2px; padding: 10px">
<div style="padding-bottom: 7px"><b><center>Lemonade stand</center></b></div>
<div style="padding-bottom: 7px"><center><button id="countButton" style="padding: 2px;"><img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px"></button></center></div>
<div><b><font color="brown">Level:</font></b> <span id="displayLevel"> 1 </span> <img src="images/plus.png" id="buyLevel" width="20px" height="18px"></div>
<div><b><font color="green">Production:</font></b> <span id="production"> 1 </span> $ </div>
<div> <font style="font-size: 15px">(Prod. per click) </font> </div>
<div><b><font color="red">Level price:</font></b> <span id="pretlevel"> 0 </span> $ </div>
</div>
<div style="background: url(images/texture.png); display: table-cell; margin-left: auto; margin-right:auto; border: solid black 2px; padding: 10px">
<div style="padding-bottom: 7px"><b><center>Lemonade stand</center></b></div>
<div style="padding-bottom: 7px"><center><button id="countButton" style="padding: 2px;"><img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px"></button></center></div>
<div><b><font color="brown">Level:</font></b> <span id="displayLevel"> 1 </span> <img src="images/plus.png" id="buyLevel" width="20px" height="18px"></div>
<div><b><font color="green">Production:</font></b> <span id="production"> 1 </span> $ </div>
<div> <font style="font-size: 15px">(Prod. per click) </font> </div>
<div><b><font color="red">Level price:</font></b> <span id="pretlevel"> 0 </span> $ </div>
</div>
DEMO http://jsfiddle.net/o7jarr8n/
HTML
<div class="row">
<div class="box">1</div>
<div class="box">2</div>
</div>
<div class="row">
<div class="box">3</div>
<div class="box">4</div>
</div>
CSS
.row {
margin: 0 auto;
text-align:center;
display:block; // change line
}
.box {
display:inline-block; // same line
background:red;
width:100px;
height:50px;
margin:5px;
}
inline-block, will make div next to each other
Well, you have different options here.
You can use inline-block as display.
You can use float: left with width: 40% for example.
So, for diversity here it is with floated divs.
Also, notice I've placed the css as an external thing so you can have a good base to really learn how to do things.
I've used class selectors, and if you don't know what it is I advice you to look for them. They are the basic of CSS.
.item {
background: url(images/texture.png);
border: solid black 2px;
padding: 10px;
width: 40%;
float: left;
}
.line {
padding-bottom: 7px;
}
.item-container {
max-width: 300px;
}
<div class="item-container">
<div class="item">
<div class="line">
<b>Lemonade stand</b>
</div>
<div class="line">
<button id="countButton" style="padding: 2px;">
<img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px">
</button>
</div>
<div><b>Level:</b><span id="displayLevel"> 1 </span>
<img src="images/plus.png" id="buyLevel" width="20px" height="18px">
</div>
<div><b>Production:</b><span id="production"> 1 </span> $</div>
<div>(Prod. per click)
</div>
<div><b>Level price:</b><span id="pretlevel"> 0 </span> $</div>
</div>
<div class="item">
<div class="line">
<b>Lemonade stand</b>
</div>
<div class="line">
<button id="countButton" style="padding: 2px;">
<img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px">
</button>
</div>
<div><b>Level:</b><span id="displayLevel"> 1 </span>
<img src="images/plus.png" id="buyLevel" width="20px" height="18px">
</div>
<div><b>Production:</b><span id="production"> 1 </span> $</div>
<div>(Prod. per click)
</div>
<div><b>Level price:</b><span id="pretlevel"> 0 </span> $</div>
</div>
</div>
And I've placed both item inside item-container and you can manipulate the width of the parent to achieve a grid system if you desire.
Just a quick note also, if you use float look what is a clearfix. What is a clearfix?
Or using table, table-row, table-cell for display divs
div container isn't centered vertically, only horizontally... You can use, for example, margin:100px auto; ....
JSFiddle example (not centered vertically :( )
You can use either display: table (which has some browser compatibility issues) and display: inline-block (which I preffer):
<div style="background: url(images/texture.png);display:inline-block;width:45%; margin-left: auto; margin-right:auto; border: solid black 2px; padding: 10px">
<div style="padding-bottom: 7px"><b><center>Lemonade stand</center></b></div>
<div style="padding-bottom: 7px"><center><button id="countButton" style="padding: 2px;"><img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px"></button></center></div>
<div><b><font color="brown">Level:</font></b></td> <td> <span id="displayLevel"> 1 </span> <img src="images/plus.png" id="buyLevel" width="20px" height="18px"></div>
<div><b><font color="green">Production:</font></b> </td> <td> <span id="production"> 1 </span> $ </div>
<div> <font style="font-size: 15px">(Prod. per click) </font> </div>
<div><b><font color="red">Level price:</font></b> </td> <td> <span id="pretlevel"> 0 </span> $ </div>
</div><div style="background: url(images/texture.png);display:inline-block;width:45%; margin-left: auto; margin-right:auto; border: solid black 2px; padding: 10px">
<div style="padding-bottom: 7px"><b><center>Restaurant</center></b></div>
<div style="padding-bottom: 7px"><center><button id="countButton" style="padding: 2px;"><img src="images/lemonade.png" width="50px" height="50px" style="padding: 2px"></button></center></div>
<div><b><font color="brown">Level:</font></b></td> <td> <span id="displayLevel"> 1 </span> <img src="images/plus.png" id="buyLevel" width="20px" height="18px"></div>
<div><b><font color="green">Production:</font></b> </td> <td> <span id="production"> 1 </span> $ </div>
<div> <font style="font-size: 15px">(Prod. per click) </font> </div>
<div><b><font color="red">Level price:</font></b> </td> <td> <span id="pretlevel"> 0 </span> $ </div>
</div>
.bloc {
background: url(images/texture.png);
display: inline-block;
margin-left: auto;
margin-right:auto;
border: solid black 2px;
padding: 10px
}
.bloc-title {
padding-bottom: 7px;
font-weight : bold;
text-align : center;
}
.bouton-count {
padding: 2px;
}
.bloc-main-image {
padding: 2px;
width : 50px;
height : 50px;
}
.bloc-level-name {
font-weight : bold;
color : brown;
}
.bloc-image-plus {
width : 20px;
height : 18px;
}
.bloc-production {
font-weight : bold;
color : green;
}
.bloc-prod-per-click {
font-size : 15px;
}
.bloc-level-price {
color : red;
font-weight : bold;
}
.custom-table {
display : table;
width : 100%;
}
.custom-cell {
display : table-cell;
vertical-align : middle;
}
.custom-cell-right {
text-align : right;
]
<div class="custom-table">
<div class="custom-cell custom-cell-right">
<div class="bloc">
<div class="bloc-title">
Lemonade stand
</div>
<div class="bloc-title">
<button id="countButton" class="bouton-count">
<img src="images/lemonade.png" class="bloc-main-image">
</button>
</div>
<div>
<span class="bloc-level-name">Level:</span>
<span id="displayLevel">1</span>
<img src="images/plus.png" id="buyLevel" class="bloc-image-plus">
</div>
<div>
<span class="bloc-production">Production:</span>
<span id="production">1</span>
$
</div>
<div class="bloc-prod-per-click">
(Prod. per click)
</div>
<div>
<span class="bloc-level-price">Level price:</span>
<span id="pretlevel"> 0 </span> $ </div>
</div>
</div>
<div class="custom-cell">
<div class="bloc">
<div class="bloc-title">
Lemonade stand
</div>
<div class="bloc-title">
<button id="countButton" class="bouton-count">
<img src="images/lemonade.png" class="bloc-main-image">
</button>
</div>
<div>
<span class="bloc-level-name">Level:</span>
<span id="displayLevel">1</span>
<img src="images/plus.png" id="buyLevel" class="bloc-image-plus">
</div>
<div>
<span class="bloc-production">Production:</span>
<span id="production">1</span>
$
</div>
<div class="bloc-prod-per-click">
(Prod. per click)
</div>
<div>
<span class="bloc-level-price">Level price:</span>
<span id="pretlevel"> 0 </span> $ </div>
</div>
</div>
</div>
<div class="custom-table">
<div class="custom-cell custom-cell-right">
<div class="bloc">
<div class="bloc-title">
Lemonade stand
</div>
<div class="bloc-title">
<button id="countButton" class="bouton-count">
<img src="images/lemonade.png" class="bloc-main-image">
</button>
</div>
<div>
<span class="bloc-level-name">Level:</span>
<span id="displayLevel">1</span>
<img src="images/plus.png" id="buyLevel" class="bloc-image-plus">
</div>
<div>
<span class="bloc-production">Production:</span>
<span id="production">1</span>
$
</div>
<div class="bloc-prod-per-click">
(Prod. per click)
</div>
<div>
<span class="bloc-level-price">Level price:</span>
<span id="pretlevel"> 0 </span> $ </div>
</div>
</div>
<div class="custom-cell">
<div class="bloc">
<div class="bloc-title">
Lemonade stand
</div>
<div class="bloc-title">
<button id="countButton" class="bouton-count">
<img src="images/lemonade.png" class="bloc-main-image">
</button>
</div>
<div>
<span class="bloc-level-name">Level:</span>
<span id="displayLevel">1</span>
<img src="images/plus.png" id="buyLevel" class="bloc-image-plus">
</div>
<div>
<span class="bloc-production">Production:</span>
<span id="production">1</span>
$
</div>
<div class="bloc-prod-per-click">
(Prod. per click)
</div>
<div>
<span class="bloc-level-price">Level price:</span>
<span id="pretlevel"> 0 </span> $ </div>
</div>
</div>
</div>
I put your css away and I used 2 div container to simulate a table behaviour.
Here I "packed" your bloc in 2 <div>, one with the CSS property display : table which render a table row, and the sub <div> with the property display : table-cell which render a table-cell.

Center <td> using bootstrap

I'm trying to center some inputs inside a table and set a size to this td using bootstrap (on angularjs) but I can't make it work !
What I have now:
<div class="container">
<form class="form" data-ng-submit="salvarPartida()">
<table class="table table-bordered" align="center">
<tr data-ng-repeat="partida in partidas | filter : {fase : fase}">
<td style="height: 30px; text-align: right; font-size: 10pt;">{{partida.time1.nome}}
<img data-ng-src="/images/bandeiras/{{partida.time1.imgNumber}}.png" style="vertical-align: middle;">
</td>
<td class="col-sm-6">
<div class="col-xs-3" >
<input type="text" class="form-control">
</div>
<div class="col-xs-3">
<input type="text" class="form-control">
</div>
</td>
<br>
<td style="height: 30px; text-align: left; font-size: 10pt;"><img src="/images/bandeiras/{{partida.time2.imgNumber}}.png" title="{{partida.time2.nome}}"
style="vertical-align: middle;"> {{partida.time2.nome}}</td></tr>
</table>
<button class="btn btn-primary btn-block" type="submit">Salvar</button>
<br>
<br>
</form>
</div>
Which looks like:
But my expectations are :
Nevermind the color styles, I'd like just to proper align all fields !
I've tried using align="center" on the , class="text-align" inside the td class, also tried creating a nested into this using the previous text-center class but no luck !
My jsfiddle: fiddle
Thanks so much.
Centering <td> using bootstrap is simple:
horizontally:
<td class="text-center">
vertically:
<td class="align-middle">
Can you try this:
HTML
<div class="container m-con">
<form class="form" data-ng-submit="salvarPartida()">
<table class="table table-bordered">
<tr data-ng-repeat="partida in partidas | filter : {fase : fase}">
<td class="col-sm-4 col-xs-4">
<div class="row m-row">
<div class="col-xs-12 col-sm-4 col-lg-4 col-sm-push-8 text-right">
<img src="http://placehold.it/50x50" alt="" height="50" width="50" />
</div>
<div class="col-xs-12 col-sm-8 col-lg-8 col-sm-pull-4 m-text text-right">
Brazil
</div>
</div>
</td>
<td class="col-sm-4 col-xs-4">
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-6">
<input type="text" class="form-control" />
</div>
<div class="col-xs-6 col-sm-6 col-lg-6">
<input type="text" class="form-control" />
</div>
</div>
</td>
<td class="col-sm-4 col-xs-4">
<div class="row m-row">
<div class="col-xs-12 col-sm-4 col-lg-4 text-right">
<img src="http://placehold.it/50x50" alt="" height="50" width="50" />
</div>
<div class="col-xs-12 col-sm-8 col-lg-8 m-text text-left">
Brazil
</div>
</div>
</td>
</tr>
</table>
<button class="btn btn-primary btn-block" type="submit">Salvar</button>
</form>
</div>
CSS
.m-con {
margin: 20px;
}
.m-text {
font-size: 16px;
padding-top:15px;
font-weight:bold;
}
.m-con td {
vertical-align:middle !important;
}
#media screen and (max-width:765px) {
.m-row > div {
text-align:center;
}
}
http://jsfiddle.net/vea5G/2/
//use td is padding
td{
vertical-align:middle;
padding:10px 20px;
width:1000px;
}
Try adding up custom CSS:
HTML
<div class="col-xs-3 max-center" >
<input type="text" class="form-control">
</div>
<div class="col-xs-3 max-center">
<input type="text" class="form-control">
</div>
CSS
.max-center {
text-align:center;
}
You can also try adding additional padding to the cells on the sides, but I'm not sure how much because I don't have the images. Just be careful, it can mess up the layout.