I have a Django form rendered in an HTML template, and I'm using `
` tag with the same class, the margin works fine. Is there something wrong with using `
And here's my CSS:
.field-item {
margin-bottom: 100;
}
What could be going wrong?
3 Answers
Also, keep in mind that the HTML snippet you shared has repeated parts for the same form fields, which doesn't affect margins but could lead to confusion later on. Make sure to clean that up. And just always check your CSS for any other possible syntax issues.
You’re on the right track! Just to reiterate, CSS works perfectly fine with `
` tags is that browsers apply default margins to those. You might want to double-check the updated CSS again and clear your browser cache just to ensure the changes load properly.
It looks like the problem is that you're missing a unit in your CSS rule. Instead of just `margin-bottom: 100;`, it should be `margin-bottom: 100px;`. Without a unit, browsers simply ignore your margin settings. Once you fix that, your margins should show up as expected on those `

Thanks for clarifying! I added 'px' to the margin-bottom but I didn't see any changes in the rendered HTML. Any thoughts on why?