Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 以图像为中心,如何将其向下移动?_Html_Css - Fatal编程技术网

Html 以图像为中心,如何将其向下移动?

Html 以图像为中心,如何将其向下移动?,html,css,Html,Css,我正在制作一个单页网站。对于“较低”的页面,我将图像作为标题。我可以使用 img { display:block margin-left:auto margin-right:auto width:400px } 但是,我要求它稍微低一点。我尝试添加一个页边空白,但它似乎为整个页面添加了一个页边空白(页面变长了?)。但是,图像在我的页面上的位置不会改变。知道怎么了吗 这是一些HTML: <body> <div id="nav"> <ul&g

我正在制作一个单页网站。对于“较低”的页面,我将图像作为标题。我可以使用

img
{
display:block
margin-left:auto
margin-right:auto
width:400px
}
但是,我要求它稍微低一点。我尝试添加一个页边空白,但它似乎为整个页面添加了一个页边空白(页面变长了?)。但是,图像在我的页面上的位置不会改变。知道怎么了吗

这是一些HTML:

<body>
    <div id="nav">
         <ul>
             <li><a class="scroll" href="#about">ABOUT</a></li>
             <li><a class="scroll" href="#portfolio">WORK</a></li>
             <li><a class="scroll" href="#contact">CONTACT</a></li>
         </ul>
    </div>

    <!-- Landing Page-->
    <div id="landing">
        <img src="front.png" alt="Cover Page">
    </div>
    <!-- About -->
    <div id="page1">
      <a id="about"></a>
        <img src="Who.png" alt="About Me">
        <p>
            That sweet tailpipe of yours did have me charmed. It put a spell on me, but all the ass magic in Mexico can’t change Kenny Powers from his core beliefs. I’m not an ass man... I’m a tit man. I like big ass boobs — now, and forever... I’m not like a black guy, Vida...
        </p>
    </div>

    <!-- Work -->
    <div id="page2">
      <a id="portfolio"></a>
        <div id="container">
            <a class="fancybox" href="portfolio1.jpg" title="'Consumed' </br>Digital/Print Work"><img src="portfolio1s.png"/></a>
        </div>

    </div>

    <!-- Contact -->
    <div id="page3">
      <a id="contact"></a>
        <img src="Contact.png" alt="Contact Information">
        <p>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        </p>
    </div>
</body>

知识产权是一种权利,是一种精英的权利,是劳动和财富的暂时性权利。但是,在最低限度上,我们需要一个实验室来进行日常工作。两人或两人在一个无教区的房间里互相指责。除偶尔因疏忽而死亡外,不得因疏忽而导致动物死亡。


我所说的页眉是较低页面的页眉,而不是第一个元素。所以我不确定为什么整个页面都在向下移动。

看看相对定位是否适合您:

position: relative;
top: 10px;
只要加上。


中断
线条向下。

如果图像是第一个元素,它当然会向下移动后面的所有元素。为了帮助您,我们需要更多的代码来理解您到底想要实现什么。css缺失是为了研究您的案例。你的答案似乎不完整。请详细说明什么对这个问题有帮助,以及你为什么这么认为。永远不要用html组件来设计组件。如果你想要5px怎么办?没有选择。如果你想在任何地方都改变它呢?你必须查一下所有的BR。这不是等待