如何重新定位此图像?

时间:2014-04-20 17:21:04

标签: css wordpress

我想将this page上的图像移动到黑匣子中。怎么办呢?

感谢您的帮助。

这本书的形象被严密裁剪。它是透明背景上的PNG文件。这是我的相关代码。我希望这本书出现在功能框的右侧和文本中以包围它。

.featured-box {
  border-radius: 20px;
    background-color: #000;
    color: #fff;
    padding: 20px;
    margin: 0 auto;
    margin-top: 10px;
    overflow: visible;
    width: auto;
    max-width: 1160px; 
}

.featured-box h4 {
    font-size: 20px;
    color: #fff;

}

.featured-box p {
    padding: 0 0 20px;
}

.featured-box ul {
    margin: 0 0 20px;
}

.featured-box ul li {
    list-style-type: disc;
    margin: 0 0 0 30px;
    padding: 0;
    align: right;
}

.featured-box .enews p {
    padding: 10 10 10 10px;
    color: #fff;
    float: left;
    width: 220 px;
    margin: 10 10 10 10px;

}

.featured-box .enews #subscribe {
    padding: 20 20 20 20px;;

}

.featured-box .enews #subbox {
    background-color: #fff;
    margin: 0;
    width: 300px;

}

.featured-box .enews .myimage {

      float: right;
      margin-left: 10px;
      margin-right: 50px;
            margin-bottom: 50px;


       width: auto;
}
 .myimage {

      float: right;

}
.featured-box .enews input[type="submit"] { 
background-color: #d60000;
     padding: 10 10 10 10px;
     width: 150px;

}



@media screen and (min-width: 1024px) and (max-width: 1139px) {
    div.featured-box {
        margin-top: 135px;

    }
}

@media screen and (min-width: 1140px) {
    div.featured-box {
        margin-top: 70px;
    }
}


#text-4 > div:nth-child(1) > h4:nth-child(1) {
            color: #fff;
            font-size: 1.3em; font-weight: normal;
            text-transform: uppercase;
            background-color: #d60000; 
            position: relative;
            margin: 0px -70px 20px -50px;
            padding: 18px 0px 16px 50px;

}

#text-4 > div:nth-child(1) > h4:nth-child(1):after {
                content: '';
                display: block; height: 40px; width: 40px;
                background: url(http://bryancollins.eu/wp/wp-content/uploads/2014/04/fold.png) no-repeat 0 0; 
                position: absolute; right: 0px; bottom: -40px;

}

.page p { line-height: 1.2em; }
.page a { color: #1badd2; text-decoration: none; }
.widget li  { 

                margin: 0;  
                padding: 2px 0px 8px 35px; 
                display: block; position: relative; 
                border-bottom: none;

            }


.featured-box .widget li {
                list-style: none;
                background: url("http://bryancollins.eu/wp/wp-content/uploads/2014/04/arrow.png") no-repeat scroll 0 10px rgba(0, 0, 0, 0);
                display: block;
                margin: 0 0 0 30px;
                padding: 0 0 0 40px;
}

1 个答案:

答案 0 :(得分:1)

我想我得到你想要的东西添加这个CSS并将包含黑盒子里面的所有东西

section.enews-widget {
   overflow: hidden;
}

非常直接。

------ ------- UPDATE

对于较小的屏幕,请在较小的屏幕媒体查询中添加此内容

@media only screen and (max-width: 767px) {
 section.enews-widget {
   clear: both;
 }
 .myimage {
   float: none;
 }
 .myimage img {
   display: block;
   height: auto;
   margin: 0 auto;
 }
}
希望这就是你要找的东西。

----------更新2 -------------

看了你的CSS后看起来有些问题,请删除你文件底部的这个CSS

@media screen and (min-width: 1140px) {
div.featured-box {
    margin-top: 70px;
}

@media only screen and (max-width: 767px) {
 section.enews-widget {
 clear: both;
}
.myimage {
  float: none;
}
.myimage img {
  display: block;
  height: auto;
  margin: 0 auto;
 }


}

#text-4 > div:nth-child(1) > h4:nth-child(1) {
        color: #fff;
        font-size: 1.3em; font-weight: normal;
        text-transform: uppercase;
        background-color: #d60000; 
        position: relative;
        margin: 0px -60px 20px -20px;
        padding: 18px 0px 16px 20px;

 }

 #text-4 > div:nth-child(1) > h4:nth-child(1):after {
            content: '';
            display: block; height: 40px; width: 40px;
            background: url(http://bryancollins.eu/wp/wp-content/uploads/2014/04/fold.png) no-repeat 0 0; 
            position: absolute; right: 0px; bottom: -40px;

 }

 .page p { line-height: 1.2em; }
 .page a { color: #1badd2; text-decoration: none; }
 .widget li  { 

            margin: 0;  
            padding: 2px 0px 8px 35px; 
            display: inline; position: relative; 
            border-bottom: none;

}


 .featured-box .widget li {
            list-style: none;
            background: url("http://bryancollins.eu/wp/wp-content/uploads/2014/04/arrow.png") no-repeat scroll 0 10px rgba(0, 0, 0, 0);
            display: inline;
            margin: 0 0 0 30px;
            padding: 0 0 0 40px;
 }

有了这个:

@media screen and (min-width: 1140px) {
  div.featured-box {
    margin-top: 70px;
  }
}/* you needed to close this media query */

@media only screen and (max-width: 767px) {
 section.enews-widget {
 clear: both;
}
.myimage {
  float: none;
}
.myimage img {
  display: block;
  height: auto;
  margin: 0 auto;
 }
}

#text-4 > div:nth-child(1) > h4:nth-child(1) {
        color: #fff;
        font-size: 1.3em; font-weight: normal;
        text-transform: uppercase;
        background-color: #d60000; 
        position: relative;
        margin: 0px -60px 20px -20px;
        padding: 18px 0px 16px 20px;

 }

 #text-4 > div:nth-child(1) > h4:nth-child(1):after {
            content: '';
            display: block; height: 40px; width: 40px;
            background: url(http://bryancollins.eu/wp/wp-content/uploads/2014/04/fold.png) no-repeat 0 0; 
            position: absolute; right: 0px; bottom: -40px;

 }

 .page p { line-height: 1.2em; }
 .page a { color: #1badd2; text-decoration: none; }
 .widget li  { 

            margin: 0;  
            padding: 2px 0px 8px 35px; 
            display: inline; position: relative; 
            border-bottom: none;

}


 .featured-box .widget li {
            list-style: none;
            background: url("http://bryancollins.eu/wp/wp-content/uploads/2014/04/arrow.png") no-repeat scroll 0 10px rgba(0, 0, 0, 0);
            display: inline;
            margin: 0 0 0 30px;
            padding: 0 0 0 40px;
 }
相关问题