placing html element inline in responsive layout method - html

I want to place image, arrow , title and input textbox in particular way as in image.
Puting stlye tag in hr or td is not good practice, right? It did not help even
To keep space between tr only <br/>is option or any better way is possible?
How to keep space between arrow, title, textbox without using &nbsp
fiddle : http://jsfiddle.net/karimkhan/u7AjH/2/
I want to display content like this:
css:
.content > .container {height: 100%;}
.img-container1 { float:left; height:80% !important; width:40%}

http://jsfiddle.net/u7AjH/4/
<div class="container">
<div class="row">
<div class="col-xs-6 col-md-6">
<img src="http://placehold.it/931x754" alt="..." class="img-responsive img-rounded" />
</div>
<div class="col-xs-6 col-md-6">
<div class="row">
<div class="col-md-12">
<div class="col-xs-4 col-md-4">
=>
</div>
<div class="col-xs-4 col-md-4">
<input type="text" class="form-control"/>
</div>
<div class="col-xs-4 col-md-4">
Text Here
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-xs-4 col-md-4">
=>
</div>
<div class="col-xs-4 col-md-4" >
<textarea style="height:200px" type="text" class="form-control"></textarea>
</div>
<div class="col-xs-4 col-md-4">
Text Here
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-xs-4 col-md-4">
=>
</div>
<div class="col-xs-4 col-md-4">
<input type="text" class="form-control"/>
</div>
<div class="col-xs-4 col-md-4">
Text Here
</div>
</div>
</div>
</div>
</div>
</div>
Although its not that good because I made it just now but i think it can help you.
You may use the grid system of bootstap in order for you to make a responsive grid.
Take a look with this documentation and you will learn more about bootstrap.
http://getbootstrap.com/css/#grid
I hope it can help you.

you can achieve by adding margin as per your requirement.
try this:
.container div{
margin-right:20px;
}

HTML:
<div class="content">
<div class="container">
<div class="img-container1">
<img src="http://placehold.it/931x754" alt="..." class="img-responsive img-rounded">
</div>
<div class="text-container">
<table>
<tr>
<td>
Arrow
</td>
<td>
<input type="text" name="title" />
</td>
<td>Title</td>
</tr>
<tr>
<td>
Arrow
</td>
<td>
<textarea name="textArea"></textarea>
</td>
<td>Title</td>
</tr>
<tr>
<td>
Arrow
</td>
<td>
<input type="text" name="title" />
</td>
<td>Title</td>
</tr>
<tr>
<td>
Arrow
</td>
<td>
<input type="text" name="title" />
</td>
<td>Title</td>
</tr>
<tr>
<td>
Arrow
</td>
<td>
<input type="text" name="title" />
</td>
<td>Title</td>
</tr>
</table>
</div>
</div>
</div>
CSS
.content > .container {height: 100%;}
.img-container1 { float:left; height:80% !important; width:40%}
.img-container1 img {max-width: 100%;}
.text-container {float: left; height: 80% !important; width: 60%}
.text-container table tr{height: 50px;}
.text-container table tr td:first-child{width: 10%;text-align: center;}
.text-container table tr td{width: 40%;}
.text-container table tr td:last-child{width: 10%;text-align: center;}
.text-container table tr td input{width: 100%;}
.text-container table tr td textarea{width: 100%;height: 200px;resize: none;}
Working Example
http://jsfiddle.net/3vSyL/

Related

How to align a checkbox with specified column in table HTML

<div class="col-md-12" style="padding: 10px">
<div class="card m-b-30">
<div class="card-header container-fluid" ">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-12 table-responsive">
<div id="order-listing_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4 no-footer">
<div class="row">
<div class="col-md-12">
<table id="order-listing" class="table dataTable no-footer table-striped" style="border-bottom:1pt solid black" role="grid" aria-describedby="order-listing_info">
<thead>
<tr role="row">
<th width="70%"><b>Name</b></th>
<th><b>Active</b></th>
<th><b>Select</b></th>
<th><b>Delete</b></th>
</tr>
</thead>
<tbody>
#*#foreach (var item in Model)
{*#
<tr>
<td>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search here" style="width: 450px; height: 40px">
<div class="input-group-append">
<button class="btn btn-secondary" type="button">
<i class="dripicons-search"></i>
</button>
</div>
</div>
</td>
<td>
<input type="checkbox" name="checkbox2">
</td>
</tr>
<tr>
<td>Test New</td>
<td><input class="form-check-input" type="checkbox" id="gridCheck"></td>
<td><button type="button" class="btn btn-icons btn-inverse-secondary" id="data-editbtn-id"><div><i class="icon-pencil"></i></div></button></td>
<td><button type="button" class="btn btn-icons btn-inverse-secondary" id="data-delete-id"><div><i class="dripicons-trash"></i></div></button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I tried aligning this checkbox with the Active column but my code doesn't align it with the specified column
whats wrong with my code?
some online HTML generates output the correct code with same code but when i edit it, the aligned doesn't work properly
I have attached my code above can anyone help me im using html and css for this.
Please give the below CSS, the input element is taking CSS of margin-left.
.form-check-input{
margin:0 !important;
}
And also give this CSS
.table td, .table th{
vertical-align: middle;
}

How to vertically align divs with different contents?

I have two section on a page. I am not able to vertically align their contents. I am using vertical-align:middle yet unable to do it. I have also tried display:flex but that creates problem in responsive view.
Here is the structure:
<div class="container-fluid" style="display:table;width:100%;">
<div class="row" style="display: table-cell;vertical-align:middle;">
<div class="col-lg-9 section_1">
<div class="logo hidden-xs">
<img src="custom_images/logo.png" />
</div>
<div class="realtor">
<img src="custom_images/realtors-profileimg.png" width="70" height="70" />
</div>
<div class="name & number">
<span>Sohil shah</span>
<span>+91-972-255-2874</span>
</div>
<div class="moving_companies hidden-xs">Find Moving Companies in Chicago, IL 1-8444-4Move-EZ</div>
<div class="phone_number hidden-xs">080-888-0888</div>
<<div class="powered_by hidden-xs">
<img src="custom_images/powerdby-logo.png" />
</div>
</div>
<div class="col-lg-3 section_2" style="height:70px;">
<!--<button class="login">Login<i class="fa fa-caret"></i></button>-->
<div class="logo">
<img src="custom_images/logo.png" />
</div>
<div class="name & number">
<span>Sohil shah</span>
<span>+91-972-255-2874</span>
</div>
</div>
</div>
</div>
and the style is here....
.row > div
{
display: table-cell;
vertical-align: middle;
}
.section_1 > div
{
display: inline-block;
}
.section_2 > div
{
display: inline-block;
}
img
{
max-width: 100%;
max-height: 100%;
}
and here is the screen shot of the problem...
You had error in HTML <<div class="powered_by hidden-xs">
Here is fixed version https://jsfiddle.net/kjp91hko/2/
<div class="container-fluid" style="display:table;width:100%;">
<div class="row" style="display: table-cell;vertical-align:middle;">
<div class="col-lg-9 section_1">
<div class="logo hidden-xs">
<img src="custom_images/logo.png" />
</div>
<div class="realtor">
<img src="custom_images/realtors-profileimg.png" width="70" height="70" />
</div>
<div class="name & number">
<span>Sohil shah</span>
<span>+91-972-255-2874</span>
</div>
<div class="moving_companies hidden-xs">Find Moving Companies in Chicago, IL 1-8444-4Move-EZ</div>
<div class="phone_number hidden-xs">080-888-0888</div>
<div class="powered_by hidden-xs">
<img src="custom_images/powerdby-logo.png" />
</div>
</div>
<div class="col-lg-3 section_2" style="height:70px;">
<!--<button class="login">Login<i class="fa fa-caret"></i></button>-->
<div class="logo">
<img src="custom_images/logo.png" />
</div>
<div class="name & number">
<span>Sohil shah</span>
<span>+91-972-255-2874</span>
</div>
</div>
</div>
</div>

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.

How to keep form at centre using bootstrap 2.2.2

In this bootply the welcome as well as the form is coming on the left hand side.But I want to bring it at the centre.Can any body please tell me how to do?
<form id="form1">
<div class="container-fluid">
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="margin-bottom: 6px; margin-top: 0px; background: #efeee9">
<img src="ui_resources/img/ title.jpg" alt="" align="left">
<h2 align="center" style="margin-top: 18px;"></h2>
</div>
<div class="span1"></div>
</div>
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="background: #eee; border: 1px solid #ddd;">
<div class="span7 center login-header">
<h2 style="color:#E86537 " align="center">Welcome </h2>
</div><!--/span-->
<div class="row-fluid">
<div class="well span7 center login-box">
<div class="alert alert-info">
Please login with your Username and Password.
</div>
<fieldset>
<div class="input-prepend" title="Username" data-rel="tooltip" style="margin-left:80px;">
<span class="add-on"><i class="icon-user"></i></span><input autofocus="" class="input-large span10" name="j_username" id="username" type="text" value="">
</div>
<div class="clearfix"></div>
<div class="input-prepend" title="Password" data-rel="tooltip" style="margin-left:80px;">
<span class="add-on"><i class="icon-lock"></i></span><input class="input-large span10" name="j_password" id="password" type="password" value="">
</div>
<div class="clearfix"></div>
<div class="input-prepend" style="margin-left:80px;">
<label class="remember" for="remember"><input type="checkbox" id="remember" style="display:">Remember me</label>
</div>
<div class="clearfix"></div>
<p class="center span6" style="margin-left:80px;">
<button type="submit" class="btn btn-primary">Login</button>
New Userregister
</p>
</fieldset>
</div><!--/span-->
</div><!--/row-->
</div><!--/row-->
</div>
<div class="span1"></div>
</div></form>
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="margin-top: 6px;">
<div class="span1"></div>
</div>
</div>
try to set your welcome div in another div like this
<div class="row-fluid">
<div class="offset3 span6 center login-header">
<h2 style="color:#E86537 " align="center">Welcome </h2>
</div>
</div>
use offset
Move columns to the right using .offset* classes. Each class increases
the left margin of a column by a whole column. For example, .offset4
moves .span4 over four columns.
DEMO
Try using this in your CSS
.row-fluid .login-header,
.row-fluid .login-box{
float:none;
margin:0 auto !important;
}
Since .span* has float: left style by default, you can override it by using float:none;
.login-box {
margin:0 auto;
float:none;
}
margin:0 auto; is used to center your loginbox horizontally.

Dynamically resize divs in a table using CSS

I've searched through this site and it seems that the best way to resize components dynamically is though CSS "position" and "width/height" parameters.
I have an app which partially looks like so:
It is currently being resized through Javascript ($(window).width(), $(window).height()), and I would like to do it properly though CSS.
Here is my table layout:
<table class="table">
<tr >
<td >
<div id="chartdiv1" ></div>
</td>
<td rowspan="3">
<div id="Simulation" ></div>
<div id="SimLabels" style="border: dashed; z-index: 1; width: 190px; position: relative; ">
<input type="checkbox" onchange="redrawSim()" checked="checked" id="BedMassLabel"><strong style="color: #4bb2c5;">Bed Mass (kg)</strong><br />
<input type="checkbox" onchange="redrawSim()" checked="checked" id="H2OBedLabel"><strong style="color: #EAA228;">H2O in Fluid Bed (kg)</strong><br />
<input type="checkbox" onchange="redrawSim()" checked="checked" id="BedTempLabel"><strong style="color: #c5b47f;">Temperature of Bed (C)</strong><br />
<input type="checkbox" onchange="redrawSim()" checked="checked" id="evapRateLabel"><strong style="color: #579575;">Evaporation Rate (?)</strong>
</div>
</td>
</tr>
<tr >
<td>
<div id="chartdiv2" ></div>
</td>
</tr>
<tr >
<td >
<div id="chartdiv3" ></div>
</td>
</tr>
</table>
I have tried many combinations of positions, widths and heights, but very often it seems that no matter what percentage I put down for the width/height, the layout has a mind of its own.
It should be mentioned that I am using both MVC and Twitter Bootstrap, so perhaps my html is affected by this. Could someone help me fix my html so that it replicates the design above with dynamic sizing?
It is better to use <div> elements rather than a table for layout purposes. Check this SO Post for the reasons behind this.
Since you are using Twitter Bootstrap, your best option is using the Bootstrap's excellent (and core feature) grid system.
Here is a quick setup using Bootstrap 2.3:
<div class="row">
<div class="span3">
<div class="row">
<div class="span12">
<div id="chartdiv1" ></div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="chartdiv2" ></div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="chartdiv3" ></div>
</div>
</div>
</div>
<div class="span9">
<div id="Simulation" ></div>
</div>
</div>
or using Bootstrap 3 RC1:
<div class="row">
<div class="col-lg-3">
<div class="row">
<div class="col-lg-12">
<div id="chartdiv1" ></div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="chartdiv2" ></div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="chartdiv3" ></div>
</div>
</div>
</div>
<div class="col-lg-9">
<div id="Simulation" ></div>
</div>
</div>