0

この質問は、ヘッダーとフッターが固定され、コンテンツがスクロール可能で、スクロール可能なコンテンツが固定されているヘッダーとフッターの複製でした。これは、私にとって非常に重要です。コンテンツに固定の高さと幅を指定したくありません。 .

http://jsfiddle.net/mark69_fnd/PWRDa/にはダミー データを含む実際のフォームが含まれており、問題を示しています。ウィンドウのサイズを変更すると、フォームではなくページにスクロールバーが表示されます。現在のレイアウトでは、メニューバーとステータスバーがスクロールされて見えなくなり、フォームデータがスクロールされている間、それらを固定したままにしておきたいです。

絶対的な幅や高さのソリューションを提供しないでください。100% でな​​い限り、CSS に焼き付けるよりも、javascript で計算することを好みます。もちろん、純粋な HTML/CSS ソリューションが望ましいです。

CSSは次のとおりです。

html, body, .yui3-app-views {
    height: 100%;
    width: 100%;
}

.container {
    position: relative; /* needed for footer positioning*/
    margin: 0 auto;
    height: auto;
    min-height: 100%;
    background-color: #eee;
}

.content {
    background-color: #ddd;
    padding: 0em 0em 2em; /* bottom padding for footer */
    overflow: auto;
}

#footer {
    position: absolute;
    width: 100%;
    bottom: 0; /* stick to bottom */
    background-color: #ccc;
}

#status {
    border: solid 1px #000000;
}

#status .error {
    color: red;
    font-weight: bold;
}

/* ------------------------------------------------------------------------------------*/
.char {
    display: inline-block;
    vertical-align: top;
}

.line {
    white-space: nowrap;
}

/* --------------------------------- fieldset and legend ------------------------------*/
.fieldset {
    border: 2px groove threedface;
    margin-top: 1em;
}

.fakeFieldset {
    padding: 2px;
}

.fieldset > div.legend:first-child {
    display: inline-block;
    text-align: left;
    margin-left: 10px;
    background: #ddd;
    position: relative;
    top: -0.7em;
}

.merge-bottom {
    margin-bottom: -2px;
}

/* ------------------------------------ Forms ------------------------------*/

form div {
    white-space: nowrap;
}

form select, form input {
    margin: 2px;
    border: 1px groove;
}

form label:not(.same-line) {
    width: 8em;
    text-align: right;
    display: inline-block
}

#cust-balance {
    text-align: center;
}

.ccExpDate {
    width: 2em;
}

#cust-salutation {
    width: 4em;
}

.postalCode {
    width: 7em;
}

#cust-ccAddress {
    width: 20em;
}
​
4

1 に答える 1

2

// アスカーからの入力で更新。

これはうまくいきます。私の幅は100%に設定されていますが、もちろん、必要に応じてJSでそれを行うことができます.

ヘッダーとフッターを指定する必要がありますposition:fixed

.contentまた、上部ヘッダー用のスペースを確保するために、div にパディングを配置しました。

次のように:

html, body, .yui3-app-views {
    height: 100%;
    width: 100%;
}

.content {
    background-color: #ddd;
    padding: 2em 0em; /* padding for footer and header */
}

.menubar {
     position: fixed;
     top: 0px;
     width: 100%;
     z-index:1;
}

#footer {
    position: fixed;
    width: 100%;
    bottom: 0; /* stick to bottom */
    background-color: #ccc;
}
于 2012-10-28T04:10:14.347 に答える