I have managed to set the width of my table and the margin position to margin-left:-240px;I was supposed to set the table in bootstrap format when i resize my window. However, when I resize my window, the table position seems to be a little off from its position. How can I set the table to margin-left without affecting the bootstrap format?
<div class="container">
<div class="row">
<div class="panel panel-primary filterable">
<div class="panel-heading">
<h3 class="panel-title">Hi there</h3>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr class="filters">
<th class="col-md-2"><input type="text" class="form-control" placeholder="Type" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Course" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Description" disabled></th>
<th class="col-md-1"><input type="text" class="form-control" placeholder="Credit" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Hourly" disabled></th>
<th class="col-md-2"><input type="text" class="form-control" placeholder="Profile" disabled></th>
<th class="col-md-3"><input type="text" class="form-control" placeholder="Book" disabled></th>
</tr>
</thead>
<tbody>
<tr class="text-nowrap">
<td>3/8/2015</td>
<td>1:15 PM</td>
<td>Field 7</td>
<td>Commingles</td>
<td>Jello Shot Jockeys</td>
<td>Jello Shot Jockeys</td>
<td>Jello Shot Jockeys</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
mystyle.css
.filterable {
margin-top: 30px;
width:140%;
margin-left:-240px;
}
.filterable .panel-heading .pull-right {
margin-top: -90px;
}
.filterable .filters input[disabled] {
background-color: transparent;
border: none;
cursor: auto;
box-shadow: none;
padding: 0;
height: auto;
}
.filterable .filters input[disabled]::-webkit-input-placeholder {
color: black;
}
.filterable .filters input[disabled]::-moz-placeholder {
color: black;
}
.filterable .filters input[disabled]:-ms-input-placeholder {
color: black;
}
<div class="container-fluid">
---- navbar here ----
<div class="row" style="top:100px">
<!-- ----------- left margin ----------------- -->
<div class="col-md-2"></div>
<div class="col-md-10">
--- Your table here ---
</div>
<!-- ----------- right margin ---------------- -->
<div class="col-md-2"></div>
</div>
</div>
Related
I have a form, I tried to do it myself but did not find how to make the fields in a row (horizontally). I am very grateful because I spent a lot of time and did not find a solution.
My view business.blade.php
#extends('layouts.layout')
#section('title')Бізнес#endsection
#section ('main_content')
<h1>Бизнес</h1>
<p>
<table class="table table-dark">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Mail</th>
<th scope="col">Website</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
#foreach ($business as $singleBusiness)
<tr>
<td>{{ $singleBusiness->name}}</td>
<td>{{ $singleBusiness->mail}}</td>
<td>{{ $singleBusiness->website}}</td>
<td><a href="/delete/{{ $singleBusiness->id }}">
<button class="btn btn-danger btn-delete">Delete</button></a></td>
</tr>
#endforeach
</tbody>
</table>
</p>
<form method="post" action="/business">
{{ csrf_field() }}
<fieldset>
<div class="form-row align-items-center">
<div class="col-sm-3 my-1">
<label for="name" class="sr-only"></label>
<input type="text" class="form-control" id="name" name="name" placeholder="Name">
</div>
<div class="col-sm-3 my-1">
<label for="mail" class="sr-only"></label>
<input type="text" class="form-control" id="mail" name="mail" placeholder="Mail">
</div>
<div class="col-sm-3 my-1">
<label for="website" class="sr-only"></label>
<input type="text" class="form-control" id="website" name="website" placeholder="Website">
</div>
<button type="submit" class="btn btn-outline-warning mb-2">Додати</button>
</div>
</fieldset>
</form>
#endsection
CSS:
.container {
display: flex; // Distribute horizontally
flex-wrap: wrap; // If elements overflow the width of the container, put below
align-items: center; // Align items vertically
}
This will make the container distribute its contents horizontally. The "align-items: center" style is optional, it will align elements vertically.
I see you use tables, I don't recommend using tables, they are awful for responsiveness. Instead use flex, like this:
<style>
.row {
display: flex; // Distribute horizontally
}
.row > .column {
flex: 1; // All columns same width
// or
flex: 0 0 25%; // Each column 25%
}
</style>
<div class="row">
<div class="column">Name</div>
<div class="column">Mail</div>
<div class="column">Website</div>
<div class="column">Delete</div>
</div>
<div class="row">
<div class="column"><input></div>
<div class="column"><input></div>
<div class="column"><input></div>
<div class="column"></div>
</div>
You can also use bootstrap rows and columns, but I explain how to accomplish the same by yourself.
I cant get the two object to the same height.
The table should be on the left side and the button at center but now the button stays under the table but I dont know why.
Here is a jsfiddle for it.
Code:
<div class="container">
<div class="text-center">
<div>
<table class="table col-sm-3">
<thead></thead>
<tbody id="ranking"><tr id="xOJzQ-ik9pNq3OKbAAAA"><td>1.</td><td style="width:10px" class="align-middle"><div style="background-color:green;width: 10px; height: 10px;"></div></td><td>Name</td><td>0 Pkt.</td></tr><tr id="JaH1T-7XNkBqa2cnAAAB"><td>2.</td><td style="width:10px" class="align-middle"><div style="background-color:RosyBrown;width: 10px; height: 10px;"></div></td><td>dfsdf</td><td>0 Pkt.</td></tr><tr id="jwEfjfA6COOTeG0ZAAAC"><td>3.</td><td style="width:10px" class="align-middle"><div style="background-color:gold;width: 10px; height: 10px;"></div></td><td>ffff</td><td>0 Pkt.</td></tr></tbody>
</table>
</div>
<div>
<input type="button" class="btn" value="" id="buzzer" style="background-color:red; width: 350px; height: 350px; border: solid 50px grey;border-radius: 50px;">
</div>
</div>
Edit: Both sould be at the top, not vertical center.
Try this
<div class="container">
<div class="text-center row">
<div class="col-sm-3">
...
</div>
<div class="col-sm-6">
<input type="button" class="btn m-auto" value="" id="buzzer" style="background-color:red; width: 350px; height: 350px; border: solid 50px grey;border-radius: 50px;">
</div>
</div>
Have a look at JSFiddle
I have a four text boxes and one fa icon and below there is a table.what I want is
text size width should be equal to the table header column size. I have tried all the ways but it is not working.How can i fix that.any help would be appreciated Thanks in Advance.
th {
border-bottom: 1px solid black;
}
th,
td {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: #dddddd;
}
td {
padding: 7px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<div id="a12" style="float:left;width:100%;text-align:left;margin:5px 0px 0px 10px;">
<div style="float:left;width:26%;">
<input type="hidden" id="num" name="ctid" />
<input type="text" id="name" name="vendornamegr" value="" style="width:95%;height:25px;font-size:15px;" />
</div>
<div style="float:left;width:23%;">
<input type="text" id="designation" name="designation" value="" style="width:95%;height:25px;font-size:15px;" required />
</div>
<div style="float:left;width:12%;padding-left:2%;">
<input type="text" id="mobilegr" name="mobilegr" value="" minlength="10" maxlength="10" style="height:25px;font-size:15px;" required/>
</div>
<div style="float:left;width:22%;padding-left:4%;">
<input type="email" id="maildgr" name="mailidgr" value="" style="width:105%;height:25px;font-size:15px;" required/>
</div>
<div class="txtcbt" style="float:left;width:5%;padding-left:4%;">
<i class="fa fa-plus" style="font-size:25px;color:white;background-color:#dc143c;"></i>
</div>
</div>
<div id="tables" class="scrollingTable" style="float:left;max-height:175px;max-width:99%;overflow: auto;margin:6px 0px 0px 7px;text-align:left;">
<table id=cnttable style="width:100%;font-size:17px;">
<thead>
<tr>
<th style="width:38%;text-align:center;font-size:17px;">Name</th>
<th style="width:20%;text-align:center;font-size:17px;">Designation</th>
<th style="width:15%;text-align:center;font-size:17px;">Mobile</th>
<th style="width:24%;text-align:center;font-size:17px;">Email-Id</th>
<th style="width:5%;text-align:center;font-size:17px;">Edit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
I have updated your code with lot of changes. Like removing unwanted styles and added new styles and make it looks like what you expected.
HTML
<div id="a12" style="float:left;width:100%;text-align:left; margin-bottom:10px;">
<div style="float:left;width:36%;">
<input type="hidden" id="num" name="ctid" />
<input type="text" id="name" name="vendornamegr" value="" style="width:90%;height:25px;font-size:15px;" />
</div>
<div style="float:left;width:20%;">
<input type="text" id="designation" name="designation" value="" style="width:90%;height:25px;font-size:15px;" required />
</div>
<div style="float:left;width:15%;">
<input type="text" id="mobilegr" name="mobilegr" value="" minlength="10" maxlength="10" style="width:90%; height:25px;font-size:15px;" required/>
</div>
<div style="float:left;width:24%;">
<input type="email" id="maildgr" name="mailidgr" value="" style="width:90%;height:25px;font-size:15px;" required/>
</div>
<div class="txtcbt" style="float:left;width:5%;">
<i class="fa fa-plus" style="font-size:25px;color:white;background-color:#dc143c;"></i>
</div>
</div>
<div id="tables" class="scrollingTable" style="max-height:175px;overflow: auto; width:100%;">
<table cellspacing="0" cellpadding="0" id=cnttable>
<thead>
<tr>
<th style="width:36%;text-align:center;font-size:17px;">Name</th>
<th style="width:20%;text-align:center;font-size:17px;">Designation</th>
<th style="width:15%;text-align:center;font-size:17px;">Mobile</th>
<th style="width:24%;text-align:center;font-size:17px;">Email-Id</th>
<th style="width:5%;text-align:center;font-size:17px;">Edit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
CSS
table {
box-sizing:border-box;
width:100%;
border-top: 1px solid black;
border-left:1px solid black;
}
th {
border-bottom: 1px solid black;
border-right:1px solid black;
}
th, td {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: #dddddd;
}
#a12 > div {
text-align:center;
}
DEMO
Try this way too. I just changed some of your width sizes.
CSS
th {
border-bottom: 1px solid black;
}
th,
td {
border-collapse: collapse;
}
tr:nth-child(odd) {
background-color: #dddddd;
}
td {
padding: 7px;
}
CODE
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<div id="a12" style="float:left;width:100%;text-align:left;overflow: auto;margin:5px 0px 0px 10px;">
<div style="float:left;width:30%;">
<!-- <input type="hidden" id="num" name="ctid" /> -->
<input type="text" id="name" name="vendornamegr" value="" style="width:99%;height:25px;font-size:15px;" />
</div>
<div style="float:left;width:25%;">
<input type="text" id="designation" name="designation" value="" style="width:99%;height:25px;font-size:15px;" required />
</div>
<div style="float:left;width:15%;%;">
<input type="text" id="mobilegr" name="mobilegr" value="" minlength="10" maxlength="10" style="height:25px;font-size:15px;" required/>
</div>
<div style="float:left;width:25%;">
<input type="email" id="maildgr" name="mailidgr" value="" style="width:99%;height:25px;font-size:15px;" required/>
</div>
<div class="txtcbt" style="float:left;width:5%;">
<i class="fa fa-plus" style="font-size:25px;color:white;background-color:#dc143c;"></i>
</div>
</div>
<div id="tables" class="scrollingTable" style="float:left;max-height:175px;width:100%;overflow: auto;margin:6px 0px 0px 7px;text-align:left;">
<table id=cnttable style="width:100%;font-size:17px;">
<thead>
<tr>
<th style="width:30%;text-align:center;font-size:17px;">Name</th>
<th style="width:25%;text-align:center;font-size:17px;">Designation</th>
<th style="width:15%;text-align:center;font-size:17px;">Mobile</th>
<th style="width:25%;text-align:center;font-size:17px;">Email-Id</th>
<th style="width:5%;text-align:center;font-size:17px;">Edit</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
Why does my Bootstrap input not align right (=> see 3rd input with placeholder='Does not align right')?
The td table element has a style which defines the alignment...
When I remove the style element from the td element at set the input style text-align=right, it is still left aligned.
<div class="row">
<div class="col-md-6">
<div class="well" style="width:840px">
<table class='table borderless' style="width:800px">
<tr>
<td colspan="2">
<input class="form-control input-sm" style="width:300px;margin-bottom:0px" type="text" name="input1" placeholder="Input 1">
<input class="form-control input-sm" style="width:300px;margin-bottom:0px" type="text" name="input2" placeholder="Input 2">
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right">
<input class="form-control input-sm" style="width:300px;margin-bottom:0px" type="text" name="input3" placeholder="Does not align right">
</td>
</tr>
<tr>
</table>
</div>
</div>
</div>
Why does my Bootstrap input not align right?
Because .form-control will have display: block from bootstrap.min.css. As proof of this, if you make it an inline-block again it'll work:
.form-control { display: inline-block !important; }
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<div class="row">
<div class="col-md-6">
<div class="well" style="width:840px">
<table class='table borderless' style="width:800px">
<tr>
<td colspan="2">
<input class="form-control input-sm" style="width:300px;margin-bottom:0px" type="text" name="input1" placeholder="Input 1">
<input class="form-control input-sm" style="width:300px;margin-bottom:0px" type="text" name="input2" placeholder="Input 2">
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right">
<input class="form-control input-sm" style="width:300px;margin-bottom:0px" type="text" name="input3" placeholder="Does not align right">
</td>
</tr>
<tr>
</table>
</div>
</div>
</div>
What you probably really want is your controls to behave like that straight away. To do so make sure to utilize Bootstrap's form-inline, e.g. like this:
<div class="row form-inline">
Note that this affects the first row of inputs too. If you move the form-inline to a another spot you could choose to prevent that from happening.
That's because your input has it's display property set to block via the .form-control class. Block level elements will take up the whole width of their containing element. Even if a width is set, the remaining space is taken up by margin.
To get the input to align the way you would like change the display value to inline-block or add the class .pull-right to the input.
.form-control {
display: inline-block;
}
<input type="text" class="form-control input-sm pull-right">
Twitter Bootstrap specially set width: 100% property to the .form-control to make the life easier and handle such things with Grid system
You can go with the following solution
HTML Markup
<div class="row">
<div class="col-md-9 is-centered">
<div class="well well-form">
<!-- Two inline input fields per row -->
<div class="row">
<div class="col-sm-6 form-group">
<input class="form-control input-sm" type="text" name="input1" placeholder="Input 1">
</div>
<div class="col-sm-6 form-group">
<input class="form-control input-sm" type="text" name="input2" placeholder="Input 2">
</div>
</div>
<div class="row has-border">
<div class="col-sm-12">
<!-- Single input fields per row (pushed to the right) -->
<div class="row">
<div class="col-sm-6 pull-right">
<input class="form-control input-sm" type="text" name="input3" placeholder="align to right">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Helpers (optional)
SCSS
[class*="col-"] {
&.is-centered {
float: none;
margin-right: auto;
margin-left: auto;
}
}
.well-form {
> .row {
padding-top: 8px;
border-top: 1px solid #ddd;
}
.form-group {
margin-bottom: 8px;
}
}
CSS
[class*="col-"].is-centered {
float: none;
margin-right: auto;
margin-left: auto;
}
.well-form > .row {
padding-top: 8px;
border-top: 1px solid #ddd;
}
.well-form .form-group {
margin-bottom: 8px;
}
DEMO
Couple of things to notice:
<table> is not a good approach in this case
inline style=" to HTML tags is not good at all (even if its a demo)
Hope this helps
I want to make this form in HTML/CSS:
Unfortunately I can't seem to get the right style and alignment. I've been at it for hours now and whatever avenue I seem to take seems to get me nothing but garbage. Below is my best code, not very good, but it is what it is. Can anybody please help fix the code to reflect the above picture? I would truly appreciate it.
<style> * {
-webkit-box-sizing:border-box;
box-sizing:border-box;
}
.group:after {
content: "";
display: table;
clear: both;
}
.containerANE {
overflow: hidden;
background: #C6DEFF;
width: 992px;
}
.rightANE {
float: right;
width: 30px;
outline: 1px solid #8191a6;
}
.leftANE {
float: left;
width: 152px;
outline: 1px solid #8191a6;
}
.middleANE {
width:717px;
outline: 1px solid #8191a6;
}
</style>
<h1>E-mail US</h1>
<form action="file:///C:/Users/Owner/Desktop/confirmed.php" method="get">
<div class="group containerANE">
<div class="group rightANE">
<img width="25" src="http://i.imgur.com/881g5D7.png">
</div>
<div class="group leftANE">
Name
</div>
<div class="group middleANE">
<input type="text">
</div>
<div class="group rightANE">
<img width="25" src="http://i.imgur.com/881g5D7.png">
</div>
<div class="group leftANE">
Description
</div>
<div class=middleANE>
<textarea rows="4" cols="50">
</textarea>
</div>
<div class=rightANE>
<img width="25" src="http://i.imgur.com/881g5D7.png">
</div>
<div class=leftANE>
E-mail<br><br>Phone
</div>
<div class=middleANE>
<input type="text">
<br> OR <BR>
<input type="text">
</div>
<input type="submit" value="SUBMIT">
This is a representation of the code in JSFiddle.
This FIDDLE will give you a start.
HTML
<table class='holder'>
<tr>
<td>Name:</td>
<td><input type='text' size=40></input></td>
<td><div class='icondiv'></div></td>
</tr>
<tr>
<td>Desscription:</td>
<td><textarea rows=6 cols=31></textarea></td>
<td><div class='icondiv'></div></td>
</tr>
<tr>
<td>Email:</td>
<td><input type='text' size=40></input></td>
<td></td>
</tr>
<tr>
<td colspan='3' id='single'>or<div id='singlediv' class='icondiv'></div></td>
</tr>
<tr>
<td>Phone:</td>
<td><input type='text' size=40></input></td>
<td></td>
</tr>
<tr>
<td colspan='3' id='single'><input type='submit'></input></td>
</tr>
</table>
The CSS is a bit long, and it's in the fiddle in any case.
Play with the CSS to refine it to your needs.