Skip to content

Instantly share code, notes, and snippets.

@cdharrison
Created August 22, 2013 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdharrison/6312281 to your computer and use it in GitHub Desktop.
Save cdharrison/6312281 to your computer and use it in GitHub Desktop.
A way to get generated content to appear after* a specific table row. (*Note: it actually puts it before the row proceeding the one... but whatevs.)
<!doctype html>
<html>
<head>
<title>
Test
</title>
<meta charset="utf-8" />
<style>
table{
border: 1px solid #000;
margin: 0 auto;
width: 600px;
}
table td{
border: 1px solid #000;
}
table tr{
content: "";
display: table;
position: relative;
width: 100%;
zoom: 1; /* Stupid IE */
}
/* This will display at the start of whatever row you define. If you want it to appear below row 3, :nth-of-type(4) gets it there. */
table tr:nth-of-type(4):after{
content: '\25B2\25B2\25B2 This is included in newsletters! \25B2\25B2\25B2';
background: #000;
border: 1px solid #c00;
color: #fff;
display: table-caption;
font: normal 10px sans-serif;
margin: 0 auto;
padding: 1%;
bottom: 0;
text-align: center;
width: 97%;
}
</style>
</head>
<body>
<table>
<tr>
<td><img src="http://placehold.it/350x150" /></td>
<td>Text Goes Here</td>
</tr>
<tr>
<td><img src="http://placehold.it/350x150" /></td>
<td>Text Goes Here</td>
</tr>
<tr>
<td><img src="http://placehold.it/350x150" /></td>
<td>Text Goes Here</td>
</tr>
<tr>
<td><img src="http://placehold.it/350x150" /></td>
<td>Text Goes Here</td>
</tr>
<tr>
<td><img src="http://placehold.it/350x150" /></td>
<td>Text Goes Here</td>
</tr>
<tr>
<td><img src="http://placehold.it/350x150" /></td>
<td>Text Goes Here</td>
</tr>
</table>
</body>
</html>
@cdharrison
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment