@SLaMeeR

Как сделать анимацию display none/block?

Имеется небольшой отрывок css код
#header_profile_flat_new_settings_wrap_pad_right {
 float: left;
 width: 35px;
 text-align: center;
 cursor: pointer;
 margin-top: 11px;
}

#header_profile_flat_new_settings_icon {
 display: inline-block;
 background: url('../images/header_profile_flat_new_settings_icon.png') no-repeat;
 width: 18px;
 height: 18px;
 opacity: 0.8;
 -webkit-transition: all 0.2s ease-in-out;  
 -moz-transition: all 0.2s ease-in-out;  
 -o-transition: all 0.2s ease-in-out;  
 -ms-transition: all 0.2s ease-in-out;  
 transition: all 0.2s ease-in-out;
}

#header_profile_flat_new_settings_icon:hover {
 opacity: 1;
}

#header_profile_flat_new_settings_list_wrap {
 display: none;
 position: absolute;
 background: #537296;
 border-top: 1px solid #5b7ba1;
 -webkit-border-bottom-right-radius: 3px; 
 -webkit-border-bottom-left-radius: 3px; 
 -moz-border-radius-bottomright: 3px; 
 -moz-border-radius-bottomleft: 3px; 
 border-bottom-right-radius: 3px; 
 border-bottom-left-radius: 3px;
 margin-top: -2px;
 width: 174px;
 z-index: 999;
}

#header_profile_flat_new_settings_list_wrap a {
 display: block;
 padding: 10px;
 color: #c8d8ea;
 text-decoration: none;
 -webkit-transition: all 0.2s ease-in-out;  
 -moz-transition: all 0.2s ease-in-out;  
 -o-transition: all 0.2s ease-in-out;  
 -ms-transition: all 0.2s ease-in-out;  
 transition: all 0.2s ease-in-out;
}

#header_profile_flat_new_settings_list_wrap a:last-child {
 -webkit-border-bottom-right-radius: 3px;
 -webkit-border-bottom-left-radius: 3px;
 -moz-border-radius-bottomright: 3px;
 -moz-border-radius-bottomleft: 3px;
 border-bottom-right-radius: 3px;
 border-bottom-left-radius: 3px;
}

#header_profile_flat_new_settings_list_wrap a:hover {
 background: #5b7ba1;
 z-index: 1000;
 color: #ffffff;
}

#header {
 background: url('../images/nhead.png') #5e7b9c;
 border-bottom: 1px solid #4d6b92;
 width: 100%;
 height: 43px;
 line-height: 1;
 color: #ffffff;
 overflow: hidden;
 position: fixed;
 z-index: 1000;
 -webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
transition: opacity 0.5s;
}

#header.noactive {
 opacity: 0.8;
}

#header:hover {
 opacity: 1;
}

#header_bottom {
 border-top: 1px solid #405f85;
}


Как из него сделать простенький Display none/block анимацию в html?
  • Вопрос задан
  • 4982 просмотра
Пригласить эксперта
Ответы на вопрос 2
@AlBandito
Конкретно с помощью Display none/block можно сделать анимацию только через JS.
Если нужна анимация на чистом css, то opacity и transition в помощь.
Ответ написан
Комментировать
@Chekistchek
Если position: fixed или absolutе, то можно попробовать так:
#start_display {
    width: 100px;
    height: 100px;
    position: fixed;
    z-index: -999;
    animation-duration: 1s;
    animation-name: disappear; 
}
@keyframes disappear {
    0% {background-color: white;z-index: 999;}
    80% {background-color: white;}
    99.9% {z-index: 999}
    100% {background-color: none;z-index: -999;}
}
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы