html - Box-Shadow 在我的网站上不起作用

标签 html css image shadow

当尝试在我的网站上显示图像效果时,它们不显示。 如果我在 jsfiddle.net 上运行图像,它工作得很好。但是,当我在我的所有代码中测试它时,我的图像不起作用。我想要图像周围的边框阴影效果。这样做的代码在我的代码中,但正如您在我的网站图片中看到的那样,没有阴影。

这是我在没有图像的情况下在 jsfiddle.net 中测试它时的图像。 enter image description here

我的代码:

CSS:

#collage-container {

        /*width: 699px;*/
        width: 800px;
        /*height: 510px;*/
        height: 320px;
        float: left;
        margin-left: 200px;
        margin-top: 10px;
        background-color: #DADADA;
    }

    #collage-one{

    width: 699px;
    height: 300px;
    margin-left: 50px;
    margin-top: 10px;
    box-shadow: 0 0 20px black;
    }

HTML:

<div id = "collage-container">
    <img src = "longblue.jpg" id = "collage-one"/>
    </div>

enter image description here

更新:这是我所有的CSS

       <head>

   <style type = "text/css">


    /* Formating for body of Web Site */
    * {margin: 0; padding: 0;}
    body {
     font-family: times new roman;
     background-color: #ebebeb;


     }

    /* Fixed screen size so objects don't shift */
     #screen {
     /*
     min-width: 768px;
     min-height: 100% !important;
     margin-bottom: 30px;
     */
     /* This locks everything in place*/
     top:0px;
     margin: 0 auto; 
     width:1500px;
     height: 100%;
         padding-top:0;
         padding-bottom: 30px;
         margin-bottom: 150px;
         postion: absolute;
     margin-left: 70px;

     }

    /* Format for black strip header  */
     #header {
        background-color: black;
        height: 168px;
        width: 100%;
        position: relative;
     }

    /* Class1: Holds the navigation buttons in header   */
    .container {
        width: 960px;
        height: auto;
        margin: 0 auto;
        margin-left: 0;
    }

    /* Class2: Holds the small containers for short articles   */
    .containerShort {
                width: 480px;
                height: auto;
                margin: 0 auto;
    }

    /* Sub Classes: For Class2  */
    .short1 {

        right: 30px;
    }

    .short2 {
        right: 30px;

    }

    /* Format for Tree logo in header   */
    #logoArea {
        width: 300px;
        height: 168px;
        background-image: url(treesmall.jpg);
        float: left;
        margin-left: 30px;
        }

    /* Formating for location of navagation buttons  */
    #navArea
    {
        height: 100%;
        float: right;
        margin-right: 0px;
        margin-top: 80px;
        margin-left: 100px;


    }

    /* Removes the bullets for navagation buttons in header  */
    #nav
    {
        list-style: none;

    }

    /* Navagation formating */
    #nav a
    {
        color: white;
        text-decoration: none; /*removes underline*/

    }

    /* Formats the links of navagation buttons   */
    #nav li
    {
        float: left;
        margin-left: 60px;
        background-color: #252525;
        padding: 8px;
        bording: 1px solid silver;
        border-radius: 5px;

    }

    /* Makes a hovering effect where when the mouse hovers over the 
     links they change color  */
    #nav li:hover
    {
        background-color: gray;
    }

    /* Sub class formating for container class  */
    .page
    {
        background-color: white;
        padding: 10px;
        margin-top: 10px;
        width: 1100px;
        float: right;
        border-radius: 5px;
        padding-bottom: 1px;

    }

    /* Side quote article main page */
    .article
            {
                background-color: #ebebeb;
                padding-top: 1px;
                margin-top: 20px;
                width: 120px;
                float: right;
                border-radius: 20px;
                height: 300px;
                border: 1px solid black;
                margin-right: 20px;
                text-align: left;

    }

    /* Formating for left sidebar of information  */
    #sidebar {

    background-color: #B4B4B4;
    height: auto;
    width:350px;
    float:left;
    margin-top: 10px;
    border-radius: 5px;
    padding: 10px;
    color: #483D8B;
    }

    /* footer formating  */
    #footer {

        background-color: black;
        height: 40px;
        width: 1500px;
        color: white;
        padding-top: 10px;
        position: relative center;
        bottom: 0;
        text-align: center;
        margin-left:70px;
    }
    /* Formating of Header quote   */
    #quote {
        color: white;
        float: right;
    }

    /* Paragraph formating  */
    p {
        color: black;
        margin-bottom: 20px;
        padding: 5px;
        padding-left: 40px;
    }

    p.light {

    color: white !important;
    margin-bottom: 60px;
    padding: 5px;
    padding-left: 40px;

    }

    p .imagespace {

    padding-left: 40px;
    margin: auto;
    }

    h3 {
        margin-bottom: 60px;
    }

    h2 {

    font-family: "Times New Roman";
    font-style: oblique;
    }

    #collage-container {

        /*width: 699px;*/
        width: 800px;
        /*height: 510px;*/
        height: 320px;
        float: left;
        margin-left: 200px;
        margin-top: 10px;
        background-color: #DADADA;
    }

    #collage-one{

    width: 699px;
    height: 300px;
    margin-left: 50px;
    margin-top: 10px;
    box-shadow: 0 0 20px black;
    }

    /*#collage-two,#collage-three,
    #collage-four{

    width: 226px;
    height: 200px;
    padding: 5px;
    background-color: black;
    background-position: top center;
    float: right;

    }*/

    /*#space {

    width:300px;
    height: 508px;
    background-color: white;
    float: left;
    margin-top: 0;
    margin-left: 120px;
     box-shadow: hshadow, vshadow blur color 
    box-shadow: 10px 0 20px #B4B4B4;
    border-radius: 10px;
    }*/

    #ego {
    box-shadow: 0 0 20px #B4B4B4;
    }

    #marquee{

    color: #483D8B;
    margin-top: 10px;
    margin-bottom: 0px;
    width: 1025px;
    float: right;

    }





   </style>

   </head>

最佳答案

根据评论中的建议,看来我必须修复我的影子以接受更多浏览器版本。

谢谢大家,我会玩的。

主要帮助:@Phillips126

关于html - Box-Shadow 在我的网站上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27748000/

相关文章:

javascript - 如果用户调整在 fullpage.js 上创建的窗口的大小,如何显示水平滚动条

jquery - 使 <div> 的边框与 .left 位置对齐

javascript - Bootstrap 4 Navbar Taller 在平板电脑屏幕上的拆分行为

javascript检查图像是否存在iOS应用程序

r - 图像与 ggplot : how to plot color legend?

c# - 在 C# 中计算图像差异

javascript - Django 在按钮单击时使用 jquery .ajax() 将 html 插入 div

javascript - 黑色文本 - 黑色背景时为白色

css - 在固定页眉/页脚的移动页面上滚动内容

javascript - 使用javascript打印特定的div