I’m not sure this is a django issue but I have a template that renders the items properly except there is a large blank space between teh <1> tag item and the
. Not sure why, and I have tried moving tags, changing css styles, etc but it always renders the same.
You can use your browser’s developer tools to look at the elements on the page to see what css is styling those elements. That’ll help you identify what’s causing the excess spacing to appear.
This won’t be a Django issue. As Ken said, use the browser developer tools to see what’s going on. I would start with the table margins - is there a reason you’re setting the top and bottom margins to auto? There’s also some invalid HTML within the table - you typically have a series of th elements within a tr at the top of the table - these are the table column headers. Then you start a new row with tr and then have a series of table data cells (td) for the data. I can’t quite tell what you’re trying to achieve with the HTML you’ve shown above, but I can say for sure that you shouldn’t be wrapping a table row in a div element. Nor should you use <br></br> - that’s invalid HTML, so you can remove that.
The (br) was rendering before the table, causing the spacing issue. As I side note, I forgot (br) is an empty tag and added (/br) out of habit. Also fixed the invalid (th) tags, and removed the (div). One bad programming habit I have is once I get the program to do what I want I tend not to remove code that has no effect and should not be left in.
In this case (th) and (td) had the same effect, which was to layout a 6x0 grid of textareas.
The top & bottom margins set to auto was just a shot in the dark to try to fix the problem and I didn’t bother to remove it from the css.
If in doubt, copying the page’s HTML from the View Source panel in your browser and pasting it into something like The W3C Markup Validation Service can reveal things you’ve overlooked.
Side note: The “View Source” only shows the original page as retrieved from the server. If you have any JavaScript modifying the page, it is not reflected by “View Source” - that’s why I recommend people getting the current page from the developer tools.
Hmm. I was using “View Source” from Safari’s Developer menu; which resulted in various errors due to how things like POST are rendered such as / in a url.