久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

設(shè)置“位置:固定"的寬度div 相對(duì)于父 div

Set width of a quot;Position: fixedquot; div relative to parent div(設(shè)置“位置:固定的寬度div 相對(duì)于父 div)
本文介紹了設(shè)置“位置:固定"的寬度div 相對(duì)于父 div的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在嘗試為 div(位置:固定)提供 100% 的寬度(與其父 div 相關(guān)).但是我有一些問(wèn)題......

I'm trying to give a div (position: fixed) the width of 100% (relating to it's parent div). But I've got some problems...

第一個(gè)問(wèn)題是用inherit解決的,但還是不行.我認(rèn)為問(wèn)題在于我正在使用多個(gè) div 占用 100%/繼承寬度.您可以在 jsfiddle 更新中找到第二個(gè)問(wèn)題:http://jsfiddle.net/4bGqF/7/

狐貍示例

#container {
    width: 800px;
}

#fixed {
    position: fixed;
    width: 100%;
}

和html

<div id="container">
    <div id="fixed">Sitename</div>
    <p>
        blaat
    </p>
</div>

或者你可以試試:http://jsfiddle.net/4bGqF/

問(wèn)題似乎是固定元素總是占用窗口/文檔的寬度.有誰(shuí)知道如何解決這個(gè)問(wèn)題?

The problems seems to be that the fixed element is always taking the width of the window/document. Does anyone know how the fix this?

我不能給我的固定元素一個(gè)固定的,因?yàn)槲艺谑褂?jScrollPane 插件.是否有滾動(dòng)條取決于內(nèi)容.

I can't give my fixed element a fixed with, because I'm using the jScrollPane plugin. It depends on the content whether there's a scrollbar or not.

非常感謝!

PS:2 個(gè) div 的文本相互重疊.這只是一個(gè)例子,所以并不重要.

PS: The text of the 2 divs are on top of each other. This is just an example so that doesn't really matter.

推薦答案

我不確定第二個(gè)問(wèn)題是什么(基于您的編輯),但如果您應(yīng)用 width:inherit對(duì)于所有內(nèi)部 div,它都有效:http://jsfiddle.net/4bGqF/9/

I′m not sure as to what the second problem is (based on your edit), but if you apply width:inherit to all inner divs, it works: http://jsfiddle.net/4bGqF/9/

您可能想為需要支持但不支持 width:inherit

You might want to look into a javascript solution for browsers that you need to support and that don′t support width:inherit

這篇關(guān)于設(shè)置“位置:固定"的寬度div 相對(duì)于父 div的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How do I move a frameless window in Electron without using -webkit-app-region(如何在不使用 -webkit-app-region 的情況下在 Electron 中移動(dòng)無(wú)框窗口)
Electron title bar quot;no-dragquot; and quot;dragquot; not working(電子標(biāo)題欄“無(wú)拖動(dòng)和“拖動(dòng)不工作)
quot;require is not definedquot; error comes when i try to import js file (with node modules) to my main electron js file(“未定義要求當(dāng)我嘗試將 js 文件(帶有節(jié)點(diǎn)模塊)導(dǎo)入到我的主電子 js 文件時(shí)出現(xiàn)錯(cuò)誤) - IT屋
Background image not loading in Electron Application(背景圖像未在電子應(yīng)用程序中加載)
Print: How to stick footer on every page to the bottom?(打印:如何將每頁(yè)的頁(yè)腳粘貼到底部?)
Cannot find module in Electron(在 Electron 中找不到模塊)
主站蜘蛛池模板: 欧美成年网站 | 在线免费国产 | 久久久女女女女999久久 | 男人的天堂视频网站 | 久久久久久91 | 伊人在线 | 国内久久| 男人的天堂久久 | 狠狠爱综合网 | 欧美涩涩网 | 亚洲夜射| 精品伦精品一区二区三区视频 | 欧美色综合一区二区三区 | 亚洲每日更新 | 久久精品久久久 | 国产一区不卡 | 天堂视频一区 | 久久久精品一区二区三区 | 亚洲首页| 国产中文字幕在线 | 在线免费av电影 | 九色.com | 欧美成人免费在线 | 精品粉嫩aⅴ一区二区三区四区 | 在线观看国产 | 欧美日韩亚洲视频 | 精品在线一区二区 | 日本不卡一区 | 成人精品免费视频 | 久久精品久久久久久 | 国产精品久久久久久久午夜片 | 中国一级特黄真人毛片免费观看 | 看片91| 狠狠干天天干 | 国产日韩精品一区二区 | 欧美精品一区二区三区在线播放 | 在线观看黄视频 | 亚洲啪啪 | 日韩精品在线观看一区二区 | 四虎永久免费地址 | 91久久久www播放日本观看 |