English 中文(简体)
相对于父 div 不显示代码的代码
原标题:Code not displaying relative to parent div
  • 时间:2012-05-22 17:11:59
  •  标签:
  • css

代码中的 img 标记有以下符号: relition ,根据这个标记,它应该被放置到父体 relition 上方的 > div 上方,但我不明白为什么它不能显示在所提到的 position 上方。这里是 "tidle 。请帮助解答。

<div>
    <iframe width="350" height="350" src="http://www.youtube.com/embed/P3weDRMemD8" frameborder="0" allowfullscreen></iframe>
    <form style="border:3px;text align.center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit=                  "window.open( http://feedburner.google.com/fb/a/mailverify?uri=financeyoga/UPqT ,  popupwindow ,  scrollbars=yes,width=550,height=520 );return true">
        <input type="text" style="width:140px;padding:10px;" name="email"/>
        <input type="hidden" value="financeyoga/UPqT" name="uri"/>
        <input type="hidden" name="loc" value="en_US"/><br>
        <input style="padding:10px;" type="submit" value="Submit Email Address" />
    </form>
    <img style="position:relative;top:325px; left:10px;" src="http://financeyoga.com/wp-content/uploads/2012/05/follow.png" width="143" height="64" border="0" usemap="#Map">
    <map name="Map">
        <area shape="rect" coords="5,18,33,44" href="www.twitter.com" target="_blank" alt="twitter">
        <area shape="rect" coords="57,16,87,46" href="www.facebook.com" target="_blank" alt="facebook">
        <area shape="rect" coords="107,16,137,46" href="plus.google.com" target="_blank" alt="google plus">
    </map>        
</div>​
最佳回答

s 与 position: relational 的意思不同。

position: relative 改变所有儿童如果在他们的 CSS 中有 < code> position: absolute 的上下文,如果他们有 < code> position: absolute 的上下文。

例如:

<body>
    <div id="a">
        <div id="b">
            Hello
        </div>
    </div>
</body>

如果 div#b 具有 position: absolute 的 css, 位置与 body 相对。但如果 div#a position: relationive 的 css, 和 相对 div#a 的位置相对于 > div#a , 而不是 body

问题回答

postion: relative 设定了使用 positon: absolute 的子项目的起始点。

在包装元素上设定 < code> position: relative ,在子元素上设定 < code> position: absolute 。

我不知道您在问什么, 但如果您想要将图像与图像相对的样式显示为 diiv, 就会有一个把戏, 使父系亲属和内元素具有绝对性。 这是经过编辑的代码, 以防您听不懂我在说什么 。

http://jsfiddle.net/ZByDf/9/" rel=“no follow'>http://jsfiddle.net/ZByDf/9/





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签