Reputation: 325
I have a table created and a button. I am trying to align button div to right of table div with class named as .wrap-table but its not aligning correctly.
I used float:left property to button class but its aligning below the table not to right of table
Is there any property i am missing out to be added in css ?
Please help.
body{
overflow: hidden;
}
.wrap-table100 {
width: 60%;
}
.table100 {
background-color: #fff;
}
table {
width: 100%;
}
th, td {
font-weight: unset;
padding-right: 10px;
text-align: left;
}
.column1 {
width: 25%;
padding-left: 40px;
}
.column2 {
width: 20%;
}
.column3 {
width: 20%;
}
.column4 {
width: 20%;
}
.table100-head th {
padding-top: 10px;
padding-bottom: 12px;
}
.table100-body td {
padding-top: 16px;
padding-bottom: 16px;
}
/*==================================================================
[ Fix header ]*/
.table100 {
position: relative;
padding-top: 60px;
}
.table100-head {
position: absolute;
width: 100%;
top: 0;
left: 0;
}
.table100-body {
max-height: 400px;
overflow: auto;
}
.table100.ver2 .table100-head {
box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-o-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-ms-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
}
.table100.ver2 th {
font-family: Lato-Bold;
font-size: 18px;
color: #fa4251;
line-height: 1.4;
background-color: transparent;
}
.table100.ver2 td {
font-family: Lato-Regular;
font-size: 15px;
color: #808080;
line-height: 1.4;
}
.table100.ver2 .table100-body tr {
border-bottom: 1px solid black;
}
/*---------------------------------------------*/
.table100.ver2 {
border-radius: 10px;
overflow: hidden;
box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-webkit-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-o-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-ms-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
}
/* scrollbar body */
.js-pscroll {
position: relative;
overflow: scroll;
}
<div class="wrap-table100">
<div class="table100 ver2 m-b-110">
<div class="table100-head">
<table>
<thead>
<tr class="row100 head">
<th class="cell100 column1">Name</th>
<th class="cell100 column2">Date</th>
<th class="cell100 column3">Type</th>
<th class="cell100 column4">Status</th>
</tr>
</thead>
</table>
</div>
<div class="table100-body js-pscroll" >
<table>
<tbody >
<tr class="row100 body"style="border-bottom:1px solid black" >
<tr class="row100 body">
<td class="cell100 column1">Kavya</td>
<td class="cell100 column2">01-01-2000</td>
<td class="cell100 column3">Datamodel</td>
<td class="cell100 column4">completed</td>
</tr>
<tr class="row100 body">
<td class="cell100 column1">Kavya</td>
<td class="cell100 column2">01-01-2000</td>
<td class="cell100 column3">Datamodel</td>
<td class="cell100 column4">completed</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="dropdown">
<button type="button" class="dropbtn">dropdown menu</button>
</div>
Upvotes: 1
Views: 406
Reputation: 555
There were some closing tags missing. I edited that.
body{
overflow: hidden;
}
.container-table100 {
width: 100%;
min-height: 100vh;
background-color: #f4f5f7;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
padding: 33px 30px;
}
.wrap-table100 {
width: 60%;
}
.table100 {
background-color: #fff;
}
table {
width: 100%;
}
th, td {
font-weight: unset;
padding-right: 10px;
text-align: left;
}
.column1 {
width: 25%;
padding-left: 40px;
}
.column2 {
width: 20%;
}
.column3 {
width: 20%;
}
.column4 {
width: 20%;
}
.table100-head th {
padding-top: 10px;
padding-bottom: 12px;
}
.table100-body td {
padding-top: 16px;
padding-bottom: 16px;
}
/*==================================================================
[ Fix header ]*/
.table100 {
position: relative;
padding-top: 60px;
}
.table100-head {
position: absolute;
width: 100%;
top: 0;
left: 0;
}
.table100-body {
max-height: 400px;
overflow: auto;
}
.table100.ver2 .table100-head {
box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-o-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-ms-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
}
.table100.ver2 th {
font-family: Lato-Bold;
font-size: 18px;
color: #fa4251;
line-height: 1.4;
background-color: transparent;
}
.table100.ver2 td {
font-family: Lato-Regular;
font-size: 15px;
color: #808080;
line-height: 1.4;
}
.table100.ver2 .table100-body tr {
border-bottom: 1px solid black;
}
/*---------------------------------------------*/
.table100.ver2 {
border-radius: 10px;
overflow: hidden;
box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-webkit-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-o-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-ms-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
}
/* scrollbar body */
.js-pscroll {
position: relative;
overflow: scroll;
}
.dropdown{
float:left;
}
<div class="container-table100">
<div class="wrap-table100">
<div class="table100 ver2 m-b-110">
<div class="table100-head">
<table>
<thead>
<tr class="row100 head">
<th class="cell100 column1">Name</th>
<th class="cell100 column2">Date</th>
<th class="cell100 column3">Type</th>
<th class="cell100 column4">Status</th>
</tr>
</thead>
</table>
</div>
<div class="table100-body js-pscroll" >
<table>
<tbody >
<tr class="row100 body"style="border-bottom:1px solid black" >
<tr class="row100 body">
<td class="cell100 column1">Kavya</td>
<td class="cell100 column2">01-01-2000</td>
<td class="cell100 column3">Datamodel</td>
<td class="cell100 column4">completed</td>
</tr>
<tr class="row100 body">
<td class="cell100 column1">Kavya</td>
<td class="cell100 column2">01-01-2000</td>
<td class="cell100 column3">Datamodel</td>
<td class="cell100 column4">completed</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="dropdown">
<button type="button" class="dropbtn">dropdown menu</button>
</div>
</div>
Upvotes: 0
Reputation: 10520
Well, your problem lies under your HTML structure and you must move your button div under the main container instead of div with class wrap-table100
so since you are using flexbox already there is no need to use float and the row flex container will do the job for you.
body {
overflow: hidden;
}
.container-table100 {
width: 100%;
min-height: 100vh;
background-color: #f4f5f7;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
padding: 33px 30px;
}
.wrap-table100 {
width: 60%;
}
.table100 {
background-color: #fff;
}
table {
width: 100%;
}
th,
td {
font-weight: unset;
padding-right: 10px;
text-align: left;
}
.column1 {
width: 25%;
padding-left: 40px;
}
.column2 {
width: 20%;
}
.column3 {
width: 20%;
}
.column4 {
width: 20%;
}
.table100-head th {
padding-top: 10px;
padding-bottom: 12px;
}
.table100-body td {
padding-top: 16px;
padding-bottom: 16px;
}
/*==================================================================
[ Fix header ]*/
.table100 {
position: relative;
padding-top: 60px;
}
.table100-head {
position: absolute;
width: 100%;
top: 0;
left: 0;
}
.table100-body {
max-height: 400px;
overflow: auto;
}
.table100.ver2 .table100-head {
box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-o-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
-ms-box-shadow: 0 5px 20px 0px rgba(0, 0, 0, 0.1);
}
.table100.ver2 th {
font-family: Lato-Bold;
font-size: 18px;
color: #fa4251;
line-height: 1.4;
background-color: transparent;
}
.table100.ver2 td {
font-family: Lato-Regular;
font-size: 15px;
color: #808080;
line-height: 1.4;
}
.table100.ver2 .table100-body tr {
border-bottom: 1px solid black;
}
/*---------------------------------------------*/
.table100.ver2 {
border-radius: 10px;
overflow: hidden;
box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-webkit-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-o-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
-ms-box-shadow: 0 0px 40px 0px rgba(0, 0, 0, 0.15);
}
/* scrollbar body */
.js-pscroll {
position: relative;
overflow: scroll;
}
<div class="container-table100">
<div class="wrap-table100">
<div class="table100 ver2 m-b-110">
<div class="table100-head">
<table>
<thead>
<tr class="row100 head">
<th class="cell100 column1">Name</th>
<th class="cell100 column2">Date</th>
<th class="cell100 column3">Type</th>
<th class="cell100 column4">Status</th>
</tr>
</thead>
</table>
</div>
<div class="table100-body js-pscroll">
<table>
<tbody>
<tr class="row100 body" style="border-bottom:1px solid black">
<tr class="row100 body">
<td class="cell100 column1">Kavya</td>
<td class="cell100 column2">01-01-2000</td>
<td class="cell100 column3">Datamodel</td>
<td class="cell100 column4">completed</td>
</tr>
<tr class="row100 body">
<td class="cell100 column1">Kavya</td>
<td class="cell100 column2">01-01-2000</td>
<td class="cell100 column3">Datamodel</td>
<td class="cell100 column4">completed</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="dropdown">
<button type="button" class="dropbtn">dropdown menu</button>
</div>
</div>
Upvotes: 1