Top.Mail.Ru
Ответы

Позиционирование элементов на странице

У меня есть список со значениями масштаба канваса, но он отображается криво. Я хочу чтобы он отображался вертикально вниз. Как это можно сделать?

1234567891011121314151617181920
 <div class="geHeaderContainer">
<div class="geToolbarContainer"> 
            <div class="geToolbar"> 
 
                <a id="zoom-scale" class="geLabel" title="Масштаб (Alt+Mousewheel)"> 
                    100% 
                    <img src="https://../icons/arrow.gif" width="-1" height="-1" alt = "false|false"/> 
                    <div id="scale-dropdown"> 
                        <a class="scale-option" data-scale="0.25">25%</a> 
                        <a class="scale-option" data-scale="0.5">50%</a> 
                        <a class="scale-option" data-scale="0.75">75%</a> 
                        <a class="scale-option" data-scale="1">100%</a> 
                        <a class="scale-option" data-scale="1.25">125%</a> 
                        <a class="scale-option" data-scale="1.5">150%</a> 
                        <a class="scale-option" data-scale="1.75">175%</a> 
                    </div> 
                </a> 
            
        </div>
</div> 
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
 .geHeaderContainer{ 
    display: flex; 
    position: fixed; 
    width: 100%; 
}
.geToolbarContainer{ 
    border-width: 1px; 
    overflow: hidden; 
    position: absolute; 
    cursor: default; 
    left: 0px; 
    right: 0px; 
    top: 64px; 
    height: 50px; 
    background-color: var(--primary-color); 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); 
  } 
  .geToolbar{ 
      padding-left: 16px; 
      padding-bottom: 3px; 
      margin-top: 7px; 
 
  } 
  .geSeparator{ 
    float: left; 
    width: 1px; 
    height: 20px; 
    background: #e5e5e5; 
    margin-left: 8px; 
    margin-right: 6px; 
    margin-top: 4px; 
  } 
  .geLabel{ 
    white-space: nowrap; 
    position: relative; 
    overflow: hidden; 
    width: 50px; 
    float: left; 
    margin: 2px; 
    padding: 3px 5px 3px 5px; 
    border: 1px solid transparent; 
    transition: all 0.1s ease-in-out; 
  } 
  .geToolbar a { 
      color: #000000; 
      text-decoration: none; 
  } 
  .geToolbarContainer img{ 
      width:20px; 
      height:20px; 
  } 
 
  #scale-dropdown { 
    display: none; /* Скрываем выпадающий список по умолчанию */ 
} 
 
#scale-dropdown.open { 
    display: flex; 
} 
.scale-option { 
    display: flex; 
    padding: 5px 10px; 
    cursor: pointer; 
} 
.scale-option:hover { 
    background-color: #f0f0f0; /* Цвет фона при наведении */ 
} 
По дате
По рейтингу
Аватар пользователя
Просветленный

To display the zoom scale options vertically, you need to modify the CSS for the #scale-dropdown element. You can use the flex-direction: column property to arrange the items vertically. Here's the updated CSS:

123456789101112131415161718
 #scale-dropdown {  
    display: none; /* Скрываем выпадающий список по умолчанию */  
    flex-direction: column; /* Располагаем элементы вертикально */ 
}  
  
#scale-dropdown.open {  
    display: flex;  
    flex-direction: column; /* Располагаем элементы вертикально */ 
}  
.scale-option {  
    display: flex;  
    padding: 5px 10px;  
    cursor: pointer;  
}  
.scale-option:hover {  
    background-color: #f0f0f0; /* Цвет фона при наведении */  
} 
 

This CSS will ensure that the zoom scale options are displayed vertically when the dropdown is open.

Here's your complete CSS with the added modifications:

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
 .geHeaderContainer{  
    display: flex;  
    position: fixed;  
    width: 100%;  
} 
.geToolbarContainer{  
    border-width: 1px;  
    overflow: hidden;  
    position: absolute;  
    cursor: default;  
    left: 0px;  
    right: 0px;  
    top: 64px;  
    height: 50px;  
    background-color: var(--primary-color);  
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);  
}  
.geToolbar{  
    padding-left: 16px;  
    padding-bottom: 3px;  
    margin-top: 7px;  
}  
.geSeparator{  
    float: left;  
    width: 1px;  
    height: 20px;  
    background: #e5e5e5;  
    margin-left: 8px;  
    margin-right: 6px;  
    margin-top: 4px;  
}  
.geLabel{  
    white-space: nowrap;  
    position: relative;  
    overflow: hidden;  
    width: 50px;  
    float: left;  
    margin: 2px;  
    padding: 3px 5px 3px 5px;  
    border: 1px solid transparent;  
    transition: all 0.1s ease-in-out;  
}  
.geToolbar a {  
    color: #000000;  
    text-decoration: none;  
}  
.geToolbarContainer img{  
    width:20px;  
    height:20px;  
}  
 
#scale-dropdown {  
    display: none; /* Скрываем выпадающий список по умолчанию */  
    flex-direction: column; /* Располагаем элементы вертикально */ 
}  
  
#scale-dropdown.open {  
    display: flex;  
    flex-direction: column; /* Располагаем элементы вертикально */ 
}  
.scale-option {  
    display: flex;  
    padding: 5px 10px;  
    cursor: pointer;  
}  
.scale-option:hover {  
    background-color: #f0f0f0; /* Цвет фона при наведении */  
} 
 

Add this CSS to your existing stylesheet to ensure the zoom scale options are displayed correctly.

Аватар пользователя
Искусственный Интеллект

flex-direction:column