2017-04-07 5 views
0

.content-wrapper{ overflow:hidden; .content{position:absolute;} }の下に置かれた要素を一番上に移動する方法を整理できません。男写真と画像要素が.content要素の下に配置されて enter image description here親のオーバーフローを伴うCSSのトップZインデックスの強制:

は、下のスクリーンショットを考えてみましょう。しかし、黄色(赤い矢印で指し示されている)で強調表示されている写真上の彼の頭の部分は、親のために隠されている.content-wrapperoverflow:hiddenプロパティを持っています。主な問題は、は他のものに隠れたオーバーフローを変更できないということです。

実際にJavaScriptを使用せずにこのような問題を解決するのは本当ですか?問題を明確にするために

====補足1 ====

、私は以下のコードスニペットを作ってきました:

.wrapper{ 
 
    width:100%; 
 
    overflow:hidden; 
 
    position:initial; 
 
    padding:0 10px; 
 
    background-color:#EEEEEE; 
 
    box-sizing:border-box; 
 
} 
 

 
.content-wrapper{ 
 
    position:relative; 
 
    overflow:hidden; 
 
    background-color:#DDDDDD; 
 
    margin:10px 0; 
 
    min-height:350px; 
 
} 
 

 
.content{ 
 
    background-color:white; 
 
    position:absolute; 
 
    top:30px; 
 
    left:10px; 
 
    right:10px; 
 
    bottom:10px; 
 
} 
 

 
.content.grayed{ 
 
    background-color:#CCCCCC; 
 
} 
 

 
.content.positioned{ 
 
    top:50px; 
 
    left:180px; 
 
    bottom:-50px; //negative positioned parts supposed to be hidden 
 
    right:-50px; //as .content-wrapper has overflow:hidden; 
 
} 
 

 
.content.positioned img{ 
 
    width:40%; 
 
    height:auto; 
 
    margin-top:-40vh; //but that is not supposed to be hidden out of .content-wrapper 
 
    margin-left:10vw; 
 
    min-width:250px; 
 
}
<div class="wrapper"> 
 
.wrapper 
 
<div class="content-wrapper"> 
 
.content-wrapper 
 
<div class="content grayed" style="transform: rotate(-35deg); padding:20px;"> 
 
<strong>.content</strong> with cut off edges - that is supposed behaviour 
 
</div> 
 
</div> 
 

 
<div class="content-wrapper"> 
 
.content-wrapper 
 
<div class="content positioned"> 
 
<strong>.content</strong> 
 
<img src="//i.imgur.com/DsOdy1V.png"> 
 
<br> 
 
...and a man above is with sliced head - that is UNsupposed behaviour 
 
</div> 
 
</div> 
 

 
</div>

はありません本当にあり任意のソリューションですか?

+1

オーバーフロー隠しを使用している限り、写真はもちろん子供のままであればスクリプトはそれを克服できません。そのため、問題を再現する最小限の作業コードスニペットを投稿すると、 'overflow:hidden' – LGSon

+0

@LGSon、私は小さな例でコードスニペットを追加しました。あなたは、それを見直してください。 – impulsgraw

答えて

0

コンテンツの外側divのoverflow:visibleを作成してください。

+0

あなたは迷っていましたか?主な問題は、隠されたオーバーフローを他のものに変更できないことです。 – LGSon

関連する問題