Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody.
I was designing a page in HTML/CSS and i came up in a problem.
This is the HTML code:

ASP.NET
<body>
    <form id="form1" runat="server">
    <div id="center">
        <div id="header"></div>
        <div id="header-menu">
            <div id="main-menu">
                <ul id="menu">
                        <li><a href="#">خانه</a></li>
                        <li><a href="#">محصولات</a>
                            <ul class="sub-menu">
                                <li><a href="#">محصولات 1</a></li>
                                <li><a href="#">محصولات 2</a></li>
                            </ul>
                        </li>
                        <li><a href="#">درباره ما</a></li>
                        <li><a href="#">تماس با ما</a></li>
                </ul>
            </div>
        </div>
        <div id="right-side"></div>
        <div id="content">
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
        </div>
        <div id="left-side"></div>
        <div id="footer"></div>
    </div>
    </form>
</body>


And here is the CSS code:

HTML
body 
{
    background: -webkit-linear-gradient(180deg,#000000,#011341); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(180deg,#000000,#011341); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(180deg,#000000,#011341); /* For Firefox 3.6 to 15 */
    background: linear-gradient(180deg,#000000,#011341); /* Standard syntax */
}
#center
{
    width:1079px;
    height:auto;
    margin-left:auto;
    margin-right:auto;
    margin-top:20px;
    margin-bottom:20px;
    border-radius:10px;
    background-color:Aqua;
}
#header
{
    width:inherit;
    height:200px;
    background-color:Green;
    border-radius:10px 10px 0px 0px;
}
/*----------------------- MENU ------------------*/
#header-menu
{
    width:inherit;
    height:50px;
    background-color:Blue;
    border-radius:0px 0px 5px 5px;
    direction:rtl;
}

#main-menu
{
    position:relative;
    top:10px;
    right:10px;
}

/*Initialize*/
ul#menu, ul#menu ul.sub-menu {
    padding:0;
    margin: 0;
}
ul#menu li, ul#menu ul.sub-menu li {
    list-style-type: none;
    display: inline-block;
}
/*Link Appearance*/
ul#menu li a, ul#menu li ul.sub-menu li a {
    text-decoration: none;
    color: #fff;
    background: #666;
    padding: 5px;
    display:inline-block;
}
/*Make the parent of sub-menu relative*/
ul#menu li {
    position: relative;
}
/*sub menu*/
ul#menu li ul.sub-menu {
    display:none;
    position: absolute;
    top: 28px;
    width: 100px;
}
ul#menu li:hover ul.sub-menu {
    display:block;
}
#right-side
{
    float:right;
    width:18.1%;
    height:300px;
    border-radius:5px;
    margin:10px 10px 0px 10px;
    background-color:Orange;
}
#content
{
    float:right;
    width:60%;
    height:auto;
    border-radius:5px;
    background-color:White;
    margin-top:10px;
    padding-bottom:10px;
}
#left-side
{
    float:right;
    width:18.1%;
    height:300px;
    border-radius:5px;
    background-color:Lime;
    margin-top:10px;
    margin-right:10px;
}
#footer
{
    float:right;
    width:1079px;
    height:300px;
    border-radius:0px 0px 10px 10px;
    background-color:Black;
    margin:10px 0px 20px 0px;
}


So what's the problem with the id = center div tag?
Because i cant see the Aqua Background of center in my page.
Posted
Updated 9-May-14 8:17am
Comments
[no name] 9-May-14 13:20pm    
maybe it is a problem of the second set of twins :)
rogerfederer670 9-May-14 13:22pm    
excuse me but i didn't get what you mean!
[no name] 9-May-14 14:07pm    
Then you don't know Roger Federer ;)
rogerfederer670 9-May-14 14:09pm    
OK i think i got what you said ;)
But i wanna get help with my code.
[no name] 9-May-14 14:15pm    
I know, but for that you have to wait for some professinals. Good luck.

1 solution

in the #center, add one line:
display: inline-block;

if you want to center the whole thing add this in the body style:
text-align: center;
 
Share this answer
 
v2

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