0

サイトのブレッドクラムに div を使用しています。ブラウザウィンドウの実際のサイズとズームインでは一定のサイズのままですが、ズームアウトするとdivが縮小します。

これは使用しているコードです。どこかで編集が必要ですか?

    <style>

.breadcrumb { 
        list-style: none; 
        overflow: hidden; 
        font: 18px Lucida Sans Unicode;
        text-align: center;
}
.breadcrumb li { 
        float: left;

}
.breadcrumb li a {
        color: white;
        text-decoration: none; 
        padding: 11px 0 11px 55px;
        background:  #327ea4;                   /* fallback color */
        background:  #327ea4; 
        position: relative; 
        display: block;
        float: left;
        width: 15.12em;
        /*width: 15.1185em;*/
        cursor: default;
        border-top-left-radius: .4em;
        pointer-events: none;
}
.breadcrumb li a:after { 
        content: " "; 
        display: block; 
        width: 0; 
        height: 0;
        border-top: 50px solid transparent;           /* Go big on the size, and let overflow hide */
        border-bottom: 50px solid transparent;
        border-left: 30px solid  #327ea4;
        position: absolute;
        top: 50%;
        margin-top: -50px; 
        left: 100%;
        z-index: 2; 
}   
.breadcrumb li a:before { 
        content: " "; 
        display: block; 
        width: 0; 
        height: 0;
        border-top: 50px solid transparent;           /* Go big on the size, and let overflow hide */
        border-bottom: 50px solid transparent;
        border-left: 30px solid white;
        position: absolute;
        top: 50%;
        margin-top: -50px; 
        margin-left: 1px;
        left: 100%;
        z-index: 1; 
}   
.breadcrumb li:first-child a {
        padding-left: 30px;
}
.breadcrumb li:nth-child(2) a       { background:        #7fc1ec; color: #327ea4; cursor: default;}
.breadcrumb li:nth-child(2) a:after { border-left-color: #7fc1ec; color: #327ea4; cursor: default;}
.breadcrumb li:nth-child(3) a       { background:        #7fc1ec; color: #327ea4; cursor: default;}
.breadcrumb li:nth-child(3) a:after { border-left-color: #7fc1ec; color: #327ea4; cursor: default;}
.breadcrumb li:nth-child(4) a       { background:        #7fc1ec; color: #327ea4; cursor: default;}
.breadcrumb li:nth-child(4) a:after { border-left-color: #7fc1ec; color: #327ea4; cursor: default; }
.breadcrumb li:last-child a {
        /*background: white !important;*/
        /*color: black;*/
        pointer-events: none;
        cursor: default;
        border-top-right-radius: .4em;
}
.breadcrumb li:last-child a:after { border: 0; }
    </style>

<div style="width:75em;" oncontextmenu="return false"  >
    <ul class="breadcrumb">
        <li><a href="#">Step 1</a></li>
        <li><a href="#">Step 2</a></li>
        <li><a href="#">Step 3</a></li>
                    <li><a href="#">Step 4</a></li>
    </ul>

</div>

前もって感謝します。

4

1 に答える 1

1

次のスニペットのように、EM で要素の高さまたは幅を定義するとき...

.breadcrumb li a {
        color: white;
        text-decoration: none; 
        padding: 11px 0 11px 55px;
        background:  #327ea4;
        background:  #327ea4; 
        position: relative; 
        display: block;
        float: left;
        width: 15.12em; /* <-- RIGHT HERE */
        cursor: default;
        border-top-left-radius: .4em;
        pointer-events: none;
}

...実際には、要素のサイズをその要素のフォントサイズにバインドしています。

ブラウザの「ズーム」を大きくすると、フォント サイズが大きくなります (ピクセル単位)。

例:

font-size: 10px、したがってwidth: 2em== width: 20px

ズーム (フォントサイズを大きくする)

font-size: 12px、したがってwidth: 2em== width: 24px

于 2013-04-24T17:55:40.077 に答える