Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends

In Body tag there are 3 div :
HTML
<div class="header"></div>
<div class="menu"></div>
<div class="body"></div>


I never used any margin or padding css atribute in my project. (css file and webForm both)
But when I see the result in browsers there are about 10px spaces above the first div and also between first and second div.
t
What kind of code can cause this problem?

The whole HTML code is:
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head  runat="server">
    <title>.:: Home ::.</title>
    <link href="StyleSheet.css" rel="Stylesheet" />
</head>
<body>
    <form id="form1"  runat="server">
    <div>
        <center>
            <div class="header">
                <h1 class="title">Asp.Net Sample</h1>
            </div>
            <div class="menu">
                <ul>
                    <li><a href="Default.aspx">Home</a></li>
                    <li><a>Contact us</a></li>
                </ul>
            </div>
            <div class="body">
                <table cellspacing="15">
                    <td class="toolbox">
                    </td>
                    <td rowspan="2" class="main">
                    </td>
                    <tr>
                        <td>
                        </td>
                    </tr>
                </table>
            </div>
        </center>
    </div>
    </form>
</body>
</html>


And Here the css file:
CSS
.header
{
    font-family: Times New Roman;
    height: 140px;
    background-color: #854242;
    width: 60%;
}

.body
{
    height: 700px;
    background-color: #999;
    width: 60%;
}

.toolbox
{
    border-radius: 10px 10px 0 0;
    width: 110px;
    background-color: #7A7A7A;
    height: 150px;
}

.main
{
    border-radius: 10px 10px 10px 10px;
    width: 620px;
    background-color: #7A7A7A;
    height: 500px;
}

.menu
{
    height: 40px;
    text-align: left;
    background-color: #CCC;
    width: 60%;
}
Posted
Updated 3-Sep-13 22:32pm
v2

1 solution

Add this into your CSS
ul { margin: 0; padding: 0; }

Regards..:)
 
Share this answer
 
Comments
Meysam Toluie 4-Sep-13 5:04am    
Thank you for your time.
What about the first div? There is still an space above that.
Thanks7872 4-Sep-13 5:08am    
Can you show the class 'title' which you have applied in h1?
Meysam Toluie 4-Sep-13 5:10am    
.title
{
color: White;
margin: 0px;
}
Thanks7872 4-Sep-13 5:11am    
Rename your class 'body' to something else. Let me know what happens.
Meysam Toluie 4-Sep-13 5:15am    
Nothing happened.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900