0

このHtmlで改行を防止しようとしています

http://jsfiddle.net/DD3v8/

ウィンドウのサイズを変更すると、アイコンとテキストの両方が新しい行に分割されることがあります。私はすでに空白のCSSプロパティを試しました。テーブルアプローチも試しましたが、動作は同じです

誰が何が起こっているのか理解できますか?

前もって感謝します

4

2 に答える 2

1

あなたの問題を正しく理解していれば、テキストと「x」アイコンが飛び降りることなくウィンドウの幅をサイズ変更できる必要があります。

CSS を削除.title

min-width: 500px;

このフィドルの例を参照してください!

于 2012-05-22T15:15:46.530 に答える
1

これを試して:

.line {
            height: 44px; 
            width: 100%; 
            display: inline-block; 
            background-color: #6c7987;
            white-space: nowrap;
            position: relative;
        }

        .icon {
            position: absolute;
            left: 0;
            height: 44px; 
            width: 90px; 
            background-color: 
            #FF0080; 
            color: white;
            text-align: center;
            line-height: 44px;
            font-family: Arial;
            float: left;
            font-size: 12px;
            font-weight: bold;
            padding: 0;
        }

        .title {
            position: absolute;
            left: 90px;
            color: white;
            line-height: 44px;
            text-align: left;
            padding: 0 0 0 10px;
            font-family: Arial;
            float: left;
            font-size: 12px;
            display: inline;
            white-space:nowrap;
        }

        .botoes {

            position: absolute;
            width: 300px;
            right: 0
        }

        .botao {
            width: 46px;
            height: 45px;
            float: right;
            line-height: 44px;
            text-align: center;
            display: block;
            white-space:nowrap;
            cursor: pointer;
        }

        .botaoVerRecurso {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoVerRecurso:hover {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoEditarRecurso {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoEditarRecurso:hover {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoFavRecurso {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoFavRecurso:hover {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoPartRecurso {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoPartRecurso:hover {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoApagarRecurso {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .botaoApagarRecurso:hover {
            background: url('http://www.think-cell.com/images/cross.png') center no-repeat;
        }

        .clear {
            clear: both;
        }

</p>

説明は簡単です。フローティングでは、ホルダーの高さよりも大きい幅をホルダーに配置することはできません。フロートは自動的にそれを落とし、ラインを壊します。

ポジションを使用する場合は、次のように使用します。

CONTAINER (位置: 相対)
SUBelement (位置: 絶対、上: 0、左: 0) < 左上に
配置 SUBelement (位置: 絶対、下: 0、右: 0) < 右下に配置

W3C: http://www.w3schools.com/css/css_positioning.asp

于 2012-05-22T15:08:20.390 に答える