Reduce the gap between the rows and gap should be equal for all the rows in the form by using css in asp.net
Loading
Reduce the gap between the rows and gap should be equal for all the rows in the form by using css in asp.net
Know the answer? Post it. Somebody with the same question will find it here.
Jignesh KumarRank #91 · 22.9K reputationPosted May 3, 2023, 4:07 AM EDT
Hello,
Are you using Grdview then you can use,
vidhyadar P16 reputationPosted May 3, 2023, 4:11 AM EDT
No, I am not using the Gridview ,I am using the Css for the design of the page.
Jignesh KumarRank #91 · 22.9K reputationPosted May 3, 2023, 4:26 AM EDT
Are you using table ?
table{ border: 1px solid black; } table td { border: 1px solid black; /* Style just to show the table cell boundaries */ } table.no-spacing { border-spacing:0; /* Removes the cell spacing via CSS */ border-collapse: collapse; /* Optional - if you don't want to have double border where cells touch */ }vidhyadar P16 reputationPosted May 3, 2023, 5:16 AM EDT
Noo,I am not using table
Satya KarkiRank #78 · 24.6K reputationPosted May 3, 2023, 6:10 AM EDT
Hi, you can use Bootstrap Grid. If you are new you can get an understanding in detail from the below links
https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp
https://www.w3schools.com/bootstrap/bootstrap_grid_small.asp
Better share your code.
Sandhiya PriyaRank #26 · 43.2K reputationPosted Jan 2, 2026, 6:46 AM EST
To reduce and equalize the gap between rows in an ASP.NET form, you should control spacing using CSS, not HTML tables or
tags.Recommended approach (CSS class for rows)
1. Wrap each row in a common CSS class
2. Define spacing in CSS
.form-row { margin-bottom: 8px; /* equal gap for all rows */ }Change
8pxto any value you want.If you are usingCSS CSS
HTML / XML CSS
Know the answer? Forums 01
Arun PottiAnswers in the forums20answers02
Tahir AnsariAnswers in the forums5answers03
Kamlesh KumarAnswers in the forums5answers04
Sam HobbsAnswers in the forums4answers05
Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.Join Full leaderboard → 2026
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
table.form-table tr { height: 32px; }or
table.form-table td { padding: 6px 8px; }If you are using Bootstrap
or
.form-group { margin-bottom: 0.5rem; }What NOT to do
Don’t use multiple
tagsDon’t use inline styles repeatedly
Don’t set different margins per control
Summary
Use one CSS class for all rows
Control spacing with
margin-bottomorpaddingEnsures equal gap everywhere
Works in all ASP.NET forms
This is the cleanest and correct CSS-based solution.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts