如何在包装器中制作图像跨越包装器的整个宽度

时间:2015-08-03 13:34:51

标签: html css image width centering

我想知道如何在我的网站上制作图片,我的网站包装部分的宽度。请记住,这个包装是整个网站的85%。

以下是相关图片的HTML:

<div id="index_banner">
                                         <img class="bottom" src="images/SPAWN IMAGE.png" alt="INDEX BANNER">
                                         <img class="top" src="images/SURVIVAL IMAGE - GAMEMODES.png" alt="INDEX BANNER 2">
                                     </div>

以下是该页面上图片的CSS:

#index_banner {height: 360px;
               position: relative;}

#index_banner img {position: absolute;
                   animation: cf4FadeInOut 15s;
                   -webkit-animation: cf4FadeInOut 15s;
                   -webkit-animation-iteration-count: infinite;
                   animation-iteration-count: infinite;
                   animation-timing-function: ease-in-out;}

#index_banner img:nth-child(odd) {-webkit-animation-delay: -8s;
                                  animation-delay: 8s;
                                  animation-timing-function:ease-in-out;}

@-webkit-keyframes cf4FadeInOut {
   0% {
        opacity:0;
    }
    30% {
        opacity:0; 
    }
    40%{
        opacity:1; 
    }
    75%{
        opacity:1; 
    }
    85%{
        opacity:1; 
    }

    100% {
        opacity:0;
    }

}

@keyframes cf4FadeInOut {

   0% {
        opacity:0;
    }
    30% {
        opacity:0; 
    }
    40%{
        opacity:1; 
    }
    75%{
        opacity:1; 
    }
    85%{
        opacity:1; 
    }

    100% {
        opacity:0;
    }

}

2 个答案:

答案 0 :(得分:1)

我认为fiddle可以满足您的需求:

videosModule.controller('SelectVideoCtrl', ['VideoManager', '$scope', function(VideoManager, $scope){

    $scope.videomanager = VideoManager;

}]);

这样,<div>{{videomanager.currentVideo}}<div> 占据了页面宽度的85%,内部图像占据#index_banner {height: 360px; position: relative; width: 85%;} <-- added this #index_banner img {position: absolute; width: 100%; <-- and this animation: cf4FadeInOut 15s; -webkit-animation: ................. ................. 宽度的100%。

答案 1 :(得分:0)

啊,我明白了:

将其添加到HTML中的图像:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If Target.Range.Address = "$A$4" Then
       MsgBox "This shouldn't happen... Try again"
    Else
        Range("Vraagnummer").Value2 = Cells(Target.Range.Row, "B").Value2
    End If

End Sub

并将其添加到CSS IMG div:

height="360"

添加此项会产生所需的结果of