html - 物体不会移动

标签 html css

我有两个菜单,我希望它们都居中。 “投资组合”菜单只出现在我的投资组合页面上,所以我希望“菜单栏”菜单位于它的下方,但它们都居中。无论我如何更改边距,“菜单栏”菜单都不会移动。怎么回事?

我是网页设计的新手,我的教授也是,所以我为我的代码的错误道歉哈哈。另外,如果有一种简单的方法可以使其余文本居中

<html>
<head>
    <title>Connor Lepert: Portfolio</title>
    <link rel="icon" href="logo.png">
    <style>
        @font-face {font-family: Vanadine; src: url(vanadine.ttf);}

        a {color: white; font-family: Vanadine; text-decoration: none;}
            a:hover {color: yellow;}
        p {color: white; font-family: Vanadine;}
        footer {font-family: sans-serif; margin-left: 45%; margin-right:45%;}
        body {color: white; background-color: #ABADB0}

        #siteid
        #menubar {position: absolute; margin-left: 400px; text-align: center; font-family: Vanadine;}
        #mediaicons {margin-left: 44.5%;}
        #portfolio {margin-left: 30%; margin-right: 30%}
        #header
    </style>
</head>

<body>

    <h1>
    <div id="portfolio">
        <a href="portfolio.html">Graphic Design</a>
        <a href="photovideo.html">Photography & Videography</a>
        <a href="music.html">Music</a>
    </div>
    </h1>

    <div id="menubar">
        <a href="index.html">Home</a>
        <a href="aboutme.html">About</a>
        <a href=>Contact</a>
        <a href="resume.html">Resume</a>
        <a href="portfolio.html">Portfolio</a>
        <a href="scrapyard.html">ScrapYard</a>
    </div>

    <div id="mediaicons">
    <a href=""><img src="instagram.png" width="30px"></a>
    <a href=""><img src="tumblr.png" width="30px"></a>
    <a href=""><img src="youtube.png" width="30px"></a>
    <a href=""><img src="soundcloud.png" width="30px"></a>
    </div>

    <object data="infographic.pdf" type="pdf" width="100%" height="1000px">
    <p>
        It appears you do not have a pdf plugin for this browser. Download the pdf <a href="infographic.pdf">here</a>.
    </p>
    </object>

    <object data="pagelayout.pdf" type="pdf" width="100%" height="1000px">
    <p>
        It appears you do not have a pdf plugin for this browser. Download the pdf <a href="pagelayout.pdf">here</a>.
    </p>
    </object>

    <br>

    <footer>©<a href=> 2015 by Connor Lepert </a></footer>
</body>
</html>

最佳答案

将左/右页边距设置为自动:

#portfolio { margin: 0 auto; }

关于html - 物体不会移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29686776/

相关文章:

css - 如何让 href 在响应类中正确格式化?

css - Wordpress 子主题 css 优先级

javascript - 找出两个 dom 元素的差异,然后使它们相同

html - CSS - 如何实现 "float left"和 "text-align: center"的混合效果?

jquery - 如何使用 JQuery 打开弹出窗口?

javascript - 为什么 Bootstrap 3 Collapse 与双击时的复选框状态不同步?

javascript - 或者选择器中的运算符

javascript - 检查输入是否具有相同的值 React

html - 选择 <p> 元素的最后一行

html - 如何在上方创建一 strip 有图像和文本的垂直线,该垂直线穿过多个 <li>