Table Header width is not adjusting as body width...
Table Header width is not adjusting as body width...
Hi Guys please help me.
I am using vertical and horizontal scrolling for my table. Here everything is working fine but header width is not coming like body.
(when I right clicked on header and then clicked on inspect then it automatic adjusting )
Below is my code.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
String user = (String) session.getAttribute("firstName");
if (user == null) {
response.sendRedirect("../index.jsp");
}
%>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../Assets/js/Admin.js"></script>
<link rel="stylesheet" type="text/css" href="../Datatable/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../Datatable/css/dataTables.bootstrap.min.css">
<style type="text/css">
th, td { white-space: nowrap; }
div.dataTables_wrapper {
width: 800px;
margin: 0 auto;
}
</style>
<title>Demo Table::</title>
</head>
<body>
<div class="container-fluid">
<%@include file="Admin_header.jsp"%>
<div class="row" style="margin-top: 50px;">
<br/>
<div class="btn-group">
<a class="btn btn-primary" onclick="Show_Demo_Data();">Show Data</a>
</div>
<table class="table table-bordered mytable" id="Mytable" cellspacing="0" width="100%">
<thead class="bg-primary">
<td> <span class="glyphicon glyphicon-edit"></span></td>
<td><span class="glyphicon glyphicon-remove"></span></td>
<td>ID</td>
<td> Question</td>
<td> Option 1</td>
<td> Option 2</td>
<td> Option 3</td>
<td> Option 4</td>
<td> Answer</td>
</thead>
<tbody>
<!--this part is comming from backend -->
</tbody>
</table>
</div>
<script type="text/javascript" src="../Datatable/js/jquery.js"></script>
<script type="text/javascript" src="../Datatable/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../Datatable/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../Datatable/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript">
$('.mytable').dataTable({
"scrollY": 200,
"paging": false,
"bFilter": false,
"ordering": false,
"info": false,
"sScrollX":true
});
</script>
</div>
</body>
</html>