右边的图像被父div中断,后者有溢出:隐藏应用。也许甚至不可能我如何设置这个设置,但如果是这样,我怎么能让图像不被切断? https://jsfiddle.net/kimwild/q3vwthky/2/
figure#main-img,
figure#main-img-black {
width: 100%;
overflow: hidden;
}
figure#main-img-black {
background-color: #000000;
}
section#title {
margin: 10px auto;
padding: 0 .83333%;
/* 10px / 1200px */
max-width: 1200px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
}
section#title #hgroup {
float: left;
width: 100%;
z-index: 9020;
position: relative;
}
.parent {} figure#main-img img,
figure#main-img-black img {
/* max-width: 1400px;*/
max-width: 500px;
width: 100%;
right: 0;
top: 0;
position: absolute;
z-index: -1;
}
section#title h1.white,
section#title h1.black {
font-size: 4em;
line-height: 1em;
width: 60%;
padding: 0;
}
section#title h1.white {
color: #FFFFFF;
}
section#title h2.white,
section#title h2.black {
color: #FFFFFF;
font-size: 2em;
line-height: 1.2em;
font-weight: normal;
margin-top: 10px;
width: 40%;
}
section#title h2.white {
color: #FFFFFF;
}
<figure id="main-img-black">
<section id="title">
<div id="hgroup">
<div class="parent">
<img src="http://hauppauge.com/responsive/pics/hdpvr-rocket_top5.jpg" alt="" />
</div>
<h1 class="white">HD PVR
Rocket </h1>
<h2 class="white">Portable Game Recorder</h2>
</div>
</section>
</figure>
答案 0 :(得分:0)
答案 1 :(得分:0)
里面的图是一个奇怪的想法。如果你使用数字,为什么不使用figcaption。
<figure class='product'>
<img src="http://hauppauge.com/responsive/pics/hdpvr-rocket_top5.jpg" alt="HD PVR Rocket">
<figcaption>
<h1 class="white">HD PVR Rocket</h1>
<h2 class="white">portable game recorder</h2>
</figcaption>
</figure>
CSS:
figure {
margin: 0;
}
.product {
position: relative;
width: 100%;
background-color: #000;
text-align: right;
}
.product img {
width: 96%;
padding: 2%;
max-width: 500px;
height: auto;
}
.product figcaption {
position: absolute;
top: 0;
left: 0;
width: 96%;
padding: 2%;
text-align: left;
}
.product figcaption h1 {
width: 60%;
padding: 0;
font-size: 4em;
line-height: 1em;
}
.product figcaption h2 {
margin-top: 10px;
width: 40%;
font-size: 2em;
line-height: 1.2em;
font-weight: normal;
text-transform: capitalize;
}