English 中文(简体)
CSS 圆圆角 div, 页脚位置, 带有“ 绝对”
原标题:CSS rounded corners div, footer placement position with "absolute"

我试图用页眉和页脚来创造圆角。 我能够强迫页眉在上面,但我不明白为什么我不能强迫脚脚脚在下面。

事实上, 位置绝对; 底部: 0; 但这只是我的脚在文本的宽度。 当我添加宽度: 100%; 时, 页脚会变大吗??

这里可以看到我的代码:http://jsfiddle.net/fleduc/GN9q5/

问题回答

您设定了 left: 0 right: 0 , 不是 width: 100%; - 见测试 http://jsfiddle.net/thebabydino/GN9q5/3/

您也可以阅读此 < a href=> http://www. 456berestoreet.com/archive/2011/12/the_difference_ between_widthauto_and_width100/" rel="nofollow">http://www.456berestoreet.com/archive/2011/12/the_difference_ between_widthauto_and_width100/

确实您在此拥有绝对位置, 且 < code> width 和 < code> width : 自动 < /code > 将无法这样做, 但您必须明白, < code> width: 100 {/ code> 意指容器的 < em> width < strong >, 没有 粘贴和边框 (除非您使用 < code > box- sizing: 边框 ) 。

您在 px 中指定了 div s 宽度, 所以您可以在 px 中指定页脚宽度吗? 例如 : < a href="http://jsfiddle. net/ GN9q5/4/" rel= “ no follow” > http://jsfiddle. net/ GN9q5/4/

只有改变这个 cs 和它是要去工作; -)

.rcs .ftr {                        
        margin:110px 0 0 0; 
        font-size:1.2em; 
        padding:5px 0px 5px 10px;        
        border-bottom-left-radius: 0.35em;
        border-bottom-right-radius: 0.35em;
        border-top:1px solid #AAAAAA;
    }

“http://jsfiddle.net/GN9q5/5' rel=“no follow'>http://jsfiddle.net/GN9q5/5

绝对定位元素已不再是布局的一部分。 它们不知道父元素有多大, 所以您必须将宽度设置为静态值 。

您必须用绝对值设置您的 width , 并计算折叠。

示例:

If you have a width of 960px and a padding of "5px", your with must be 950px.

You SHOULD remove it for reason that I don t exactly know.
/*footer*/
.rcs .ftr {                        
    margin:0; 
    font-size:1.2em; 
    padding:5px 5px 5px 10px;
    position: absolute; 
    bottom: 0px;
    width: 385px;          
  border-bottom-left-radius: 0.35em;
  border-bottom-right-radius: 0.35em;
    border-top:1px solid #AAAAAA;
}

您的容器宽度设置为 400px. 左键 & amp; 右键嵌入 = 15px, 减去后将宽度设为 385px 。

更多信息: < a href=" https://stackoverflow.com/ questions/5323177/absolute-vs-res- reliative-position-width-hile" > absolute 相对于相对位置宽度 & amp; 高度

另外,确保关闭你的所有声明。





相关问题
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....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

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 ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签