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

設置“位置:固定"的寬度div 相對于父 div

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

問題描述

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

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

第一個問題是用inherit解決的,但還是不行.我認為問題在于我正在使用多個 div 占用 100%/繼承寬度.您可以在 jsfiddle 更新中找到第二個問題: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/

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

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?

我不能給我的固定元素一個固定的,因為我正在使用 jScrollPane 插件.是否有滾動條取決于內(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 個 div 的文本相互重疊.這只是一個例子,所以并不重要.

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

推薦答案

我不確定第二個問題是什么(基于您的編輯),但如果您應用 width:inherit對于所有內(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

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

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

相關文檔推薦

How do I move a frameless window in Electron without using -webkit-app-region(如何在不使用 -webkit-app-region 的情況下在 Electron 中移動無框窗口)
Electron title bar quot;no-dragquot; and quot;dragquot; not working(電子標題欄“無拖動和“拖動不工作)
quot;require is not definedquot; error comes when i try to import js file (with node modules) to my main electron js file(“未定義要求當我嘗試將 js 文件(帶有節(jié)點模塊)導入到我的主電子 js 文件時出現(xiàn)錯誤) - IT屋
Background image not loading in Electron Application(背景圖像未在電子應用程序中加載)
Print: How to stick footer on every page to the bottom?(打印:如何將每頁的頁腳粘貼到底部?)
Cannot find module in Electron(在 Electron 中找不到模塊)
主站蜘蛛池模板: 色婷婷婷婷色 | 国产一区二区三区视频免费观看 | 天天色天天射天天干 | 波多野结衣二区 | 久色激情 | 国产精品免费一区二区 | 狠狠干2020 | 一级看片免费视频 | 青青久在线视频 | 国产成人精品一区二区三区 | 麻豆视频在线看 | 欧美一区免费在线观看 | 欧美精品综合在线 | 亚洲精品一区中文字幕乱码 | 国产精品久久久久久久久久久久久久 | 日韩免费视频一区二区 | 国产九九精品 | 91在线网| 涩涩视频在线播放 | 亚洲精品在线视频 | 91视频观看 | 国产精品美女久久久久久不卡 | 日本三级全黄三级三级三级口周 | 成人性生交a做片 | 久久久性色精品国产免费观看 | 亚洲精品黄 | 亚洲精品久久久久久一区二区 | 久久91精品国产一区二区三区 | 国产久 | 成人在线免费av | 亚洲一区二区综合 | 久久草在线视频 | 亚洲精品一 | 精品久久久精品 | 久久精品国产久精国产 | 福利视频一二区 | 美女久久久久久久久 | 久色网 | 国产一区二区三区在线 | 亚洲 中文 欧美 日韩 在线观看 | 欧美黄 片免费观看 |