EDIT
This is not a great question by any means; it was really just a fluke that I discovered it and rather than delete this question I will leave it up for posterity.
END - EDIT
I'm not really sure how to search for this, but I came across it while styling my table and it's very odd. I am outputting data in PHP and populating it in a table. If I echo a string at the top of the page, the formatting of the table changes - it actually looks better - but I can't figure out why it's happening. I am using Twitter Bootstrap and PHP 7.
Here is the table:
And here is what it looks like when I echo a string at the top of the page:
I can't imagine what effect echoing a string is causing on the table styling, but the table looks better, in my opinion, when I am echoing a string. So I really have 2 questions:
- Why is this effect occurring?
- How can I achieve this effect without echoing a string on the page?
EDIT
Output HTML Before:
<html lang="en"><head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css"><!--Personalized stylesheet-->
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="message">
<span id="stats"></span>
</div>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<p id="logo" class="navbar-brand"><img src="images/logo_circle.png"> Page Title</p>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class=""><a href="#n">Problems or Suggestions?</a></li>
<li>
<p class="navbar-btn">
<a href="mailto:myname@email.com?subject=;body=Please enter your comments here:Please include a screenshot if you have run into an error:" target="_top" class="btn btn-info">E-Mail Support</a>
</p>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<form class="form-inline" name="search_records" method="POST" action="">
<div class="form-group">
<label for="active">Active? </label>
<select name="active">
<option value="Y">Yes</option>
<option value="N">No</option>
</select>
</div>
<div class="form-group">
<label for="sort">Sort By: </label>
<select name="sort">
<option value="Effective_Date">Effective Date</option>
<option value="MinMargin">Min Margin</option>
<option value="MaxMargin">Max Margin</option>
<option value="Commission_Percent">Commission Percent</option>
<option value="AOPGoal">AOP Goal</option>
<option value="Last_Modified">Last Modified</option>
</select>
</div>
<div class="form-group">
<label for="order">Order: </label>
<select name="order">
<option value="ASC">Ascending</option>
<option value="DESC">Descending</option>
</select>
</div>
<button type="submit" class="btn btn-default" name="submit_search_records">Search</button>
</form>
<div class="row clearfix center">
<h2>Active Records</h2>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Effective_Date</th>
<th>Min Margin</th>
<th>Max Margin</th>
<th>Commission Percent</th>
<th>Year</th>
<th>Month</th>
<th>AOP Goal</th>
<th>Last Modified</th>
<th>Modified By</th>
</tr>
</thead>
<tbody>
<tr>
<input type="hidden" value="2">
<td>2017-04-05</td>
<td>60100</td>
<td>126000</td>
<td>.030%</td>
<td>2017</td>
<td>April </td>
<td>26000</td>
<td>2017-04-05 10:49:57</td>
<td>localhost\DEV</td>
</tr><tr>
<input type="hidden" value="3">
<td>2017-04-05</td>
<td>60100</td>
<td>126000</td>
<td>.030%</td>
<td>2017</td>
<td>April </td>
<td>26000</td>
<td>2017-04-05 10:50:00</td>
<td>localhost\DEV</td>
</tr><tr>
<input type="hidden" value="4">
<td>2017-04-05</td>
<td>60100</td>
<td>126000</td>
<td>.030%</td>
<td>2017</td>
<td>April </td>
<td>26000</td>
<td>2017-04-05 10:50:06</td>
<td>localhost\DEV</td>
</tr> </tbody>
</table>
<div class="spacer"></div>
</div>
<div class="spacer"></div>
</div>
</body></html>
Output HTML After:
<html lang="en"><head></head><body>Table looks better
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css"><!--Personalized stylesheet-->
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<div id="message">
<span id="stats"></span>
</div>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<p id="logo" class="navbar-brand"><img src="images/logo_circle.png" > Page Title</p>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class=""><a href="#n">Problems or Suggestions?</a></li>
<li>
<p class="navbar-btn">
<a href="mailto:myname@email.com?subject=;body=Please enter your comments here:Please include a screenshot if you have run into an error:" target="_top" class="btn btn-info">E-Mail Support</a>
</p>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<form class="form-inline" name="search_records" method="POST" action="">
<div class="form-group">
<label for="active">Active? </label>
<select name="active">
<option value="Y">Yes</option>
<option value="N">No</option>
</select>
</div>
<div class="form-group">
<label for="sort">Sort By: </label>
<select name="sort">
<option value="Effective_Date">Effective Date</option>
<option value="MinMargin">Min Margin</option>
<option value="MaxMargin">Max Margin</option>
<option value="Commission_Percent">Commission Percent</option>
<option value="AOPGoal">AOP Goal</option>
<option value="Last_Modified">Last Modified</option>
</select>
</div>
<div class="form-group">
<label for="order">Order: </label>
<select name="order">
<option value="ASC">Ascending</option>
<option value="DESC">Descending</option>
</select>
</div>
<button type="submit" class="btn btn-default" name="submit_search_records">Search</button>
</form>
<div class="row clearfix center">
<h2>Active Records</h2>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Effective_Date</th>
<th>Min Margin</th>
<th>Max Margin</th>
<th>Commission Percent</th>
<th>Year</th>
<th>Month</th>
<th>AOP Goal</th>
<th>Last Modified</th>
<th>Modified By</th>
</tr>
</thead>
<tbody>
<tr>
<input type="hidden" value="2">
<td>2017-04-05</td>
<td>60100</td>
<td>126000</td>
<td>.030%</td>
<td>2017</td>
<td>April </td>
<td>26000</td>
<td>2017-04-05 10:49:57</td>
<td>localhost\DEV</td>
</tr><tr>
<input type="hidden" value="3">
<td>2017-04-05</td>
<td>60100</td>
<td>126000</td>
<td>.030%</td>
<td>2017</td>
<td>April </td>
<td>26000</td>
<td>2017-04-05 10:50:00</td>
<td>localhost\DEV</td>
</tr><tr>
<input type="hidden" value="4">
<td>2017-04-05</td>
<td>60100</td>
<td>126000</td>
<td>.030%</td>
<td>2017</td>
<td>April </td>
<td>26000</td>
<td>2017-04-05 10:50:06</td>
<td>localhost\DEV</td>
</tr> </tbody>
</table>
<div class="spacer"></div>
</div>
<div class="spacer"></div>
</div>
</body></html>