首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Div标签不会根据指定的位置更改位置。

Div标签不会根据指定的位置更改位置。
EN

Stack Overflow用户
提问于 2016-01-10 19:37:53
回答 1查看 2.2K关注 0票数 0

我是一个正在学习HTML的学生,在定位div标签时遇到了困难。当我试图改变位置(我需要它是“位置:固定的”),它不会移动。我从其他线程中收集到的是div标记是相对于主体定位自己的,但是如果它的位置被设置为固定的,那么它不是应该被修复吗?

注:这一切都很混乱,因为我还在努力学习语言。我包含了整个HTML文件,以防其他原因导致错误。文档中还没有涉及到CSS文件。

下面是我正在努力工作的部分。提前谢谢。

代码语言:javascript
复制
a{position:fixed;}
代码语言:javascript
复制
<div style="background:#A7DbD8;positon:absolute;left:50px;height:25px;width:500px;border:3px solid #19B3B0">
  <a href="home.html" style="left:40px">Home</a>
  <a href="portfolio.html" style="left:90px;">Portfolio</a>
  <a href="links.html" style="left:140px;">Links</a>
  <a href="contact.html" style="left:190px;">Contact</a>
</div>

代码语言:javascript
复制
body{font-fmaily:Times New Roman;}
h1,p{text-align:center;}
a{position:fixed;}
代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>
  <title>Jem Jolly</title>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>

  <div> 
    <img src="Random Banner.png" alt="Random Banner"  style="position:fixed;left:130px;top:43px"/> 
  </div>

  <div style="background:#A7DbD8;positon:absolute;left:50px;height:25px;width:500px;border:3px solid #19B3B0">
    <a href="home.html" style="left:40px">Home</a>
    <a href="portfolio.html" style="left:90px;">Portfolio</a>
    <a href="links.html" style="left:140px;">Links</a>
    <a href="contact.html" style="left:190px;">Contact</a>
  </div>

  <div>
    <div style="background:#A7DbD8;position:fixed;height:300px;width:600px;top:175px;left:20px;border:3px solid #19B3B0">
      <h1 style="font-family:cooper black;">JEM JOLLY</h1>
      <p>JEM JOLLY Founded in 2000, Jem Jolly started as a small, family-owned jewelry store. All of our products were hand-crafted by local artists, metalsmiths, and bead workers. Since our humble beginnings, we have grown into a nationwide company with distributors, retailers, and other wholesalers representing us and our products in 20 states, as well as Canada and the UK. Check out our retailer list <insert link to retailer page once it is created> for locations near you.</p>
      <p>We also take custom orders. Feel free to send us specific instructions for custom orders through our contact form <insert link to contact page once it is created>, if you are interested in a unique item for that special someone!</p>
      <p>Jem Jolly is pleased to be your supplier of finely crafted, high-quality jewelry that is timeless, eye-catching, and unlike anything you've seen before.
    </p>
    </div>
  </div>

  <div>
    <div style="background:A7DbD8;position:fixed;height:240px;width:320px;top:175px;left:640px;border:3px solid #19B3B0">
      <video width="320" height="240" controls>
        <source src="intermediate_web_design_U4L3_vid 10-39-13.mp4" type="video/mp4"></source>
      </video>
    </div>

  </div>

  <div style=width:500px;height:100px; position: relative;">

    <img src="rsz_3logo.png" alt="Random Logo" style="left:20px;top:43px"/>

  </div>

</body>
</html>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-10 20:06:33

你拼错了这个词的位置

代码语言:javascript
复制
<div style="background:#A7DbD8;positon:absolute;left:50px;height:25px;width:500px;border:3px solid #19B3B0">

修正到

代码语言:javascript
复制
<div style="background:#A7DbD8;position:absolute;left:50px;height:25px;width:500px;border:3px solid #19B3B0">

你在和某种编辑一起工作吗?如果你只使用记事本,你就会因为那些小错误而生气。给自己找个好编辑..。

另外,您不需要所有这些菜单项都处于固定位置,父元素是固定的就足够了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34709930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档