drfif48428 2014-07-23 06:26
浏览 27
已采纳

html / css设计的盒子没有正确排队

Tonight, I am going to start making my website more professional looking and start adding content. The first issue I would like to adress is one that has been bugging me for a long time. If you go to my website, you will see that the boxes are off centered (and floating to the left) while everything else is lining up in the center. ive gone over my html/css/php code, but I can't figure out the issue (Web based programming is not one of my strong suits, however I would rather learn and code it myself instead of paying someone to do it for me). Anyways, the generated html code:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Dragon Tooth Software</title>

        <link rel="icon"       href="/images/favicon.ico" />
        <link rel="stylesheet" href="css/main.css" />
        <link rel="stylesheet" href="css/font.css" />
        <link rel="stylesheet" href="css/banner.css" />
        <link rel="stylesheet" href="css/navbar.css" />
        <link rel="stylesheet" href="css/index.css" />
        <link rel="stylesheet" href="css/box.css" />

        <meta name="google-site-verification" content="1OG6sLqFnSg_Azq0tJjkpqPklx0KhO1cu7S5ii60FKc" />
    </head>

    <body>
        <header>
    <a href="/index.php"><img src="/images/banner.jpg" height="100px" width="925px" /></a>
    <h1>Dragon Tooth Software</h1>
    <h2>Rule the Web</h2>
</header>
<nav>
<ul>
<li class="current"><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li><a href="projects.php">Projects</a></li>
<li><a href="tutorials.php">Tutorials</a></li>
</ul>
</nav>

    <div class="content-box">
<h1 class="header">Welcome to Dragon Tooth Software</h1><p class="content">Greetings! I am DTSCode!</p>
</div><br /><div class="content-box">
<h1 class="header">Thursday, July 17<sup>th</sup>, 2014</h1><p class="content">www.dragontoothsoftware.com is officially open!</p>
</div><br />    </body>
</html>

and the css file that makes up the box:

.content-box {
    float: center;
    padding: 20px;
    border-radius: 10px;
    border: 10px solid gray;
}
  • 写回答

4条回答 默认 最新

  • duanlaofu4108 2014-07-23 06:35
    关注

    You need to remove the default margin and padding values from the UL tag in the NAV element.

    nav ul {
        margin: 0;
        padding: 0;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?