2017-08-03 3 views
0

何が間違っていますか? Chrome、Firefox、OperaではSafari/Explorerではうまくいきません。エクスプローラとSafariのjustify-content

親は右下にあり、親はchild1(親を中心に垂直)です。親はサイズが違うかもしれませんし、子供はまだそれを超えていなければなりません。

example image

.cotainer{ 
 
    position: fixed; 
 
    bottom: 0px; 
 
    right: 0px; 
 
    display: -webkit-box; 
 
    display: -moz-box; 
 
    display: -ms-flexbox; 
 
    display: -webkit-flex; 
 
    margin: 10px; 
 
} 
 

 

 
.parent { 
 
    width: 80px; 
 
    height:80px; 
 
    min-width: 80px; 
 
    min-height:80px; 
 
    background-color:#8BBF46; 
 
    border-radius:50%; 
 
    bottom: 0px; 
 
    right: 0px; 
 
    position: relative; 
 
    text-align: center; 
 
    cursor: pointer; 
 
    padding: 0; 
 
    margin: 0; 
 
    display: -webkit-box; 
 
    display: -moz-box; 
 
    display: -ms-flexbox; 
 
    display: -webkit-flex; 
 
    display: flex; 
 
    align-items: center; 
 
    justify-content: center; 
 
    margin: 15px; 
 
    order: 1; 
 
    order: -webkit-1; 
 
    order: -moz-1; 
 
    order: -ms-1; 
 
    order: -webkit-1; 
 
} 
 

 
.child1{ 
 
    position: absolute; 
 
    bottom: 100%; 
 
} 
 

 
.child2{ 
 
    font-size: 16px; 
 
    color: #222; 
 
    padding: 0.4em; 
 
    display: block; 
 

 
} 
 

 
.child2:hover{ 
 
    color: #fff; 
 
}
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <meta charset="UTF-8"> 
 
    <link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700"> 
 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 
 
    <link type="text/css" rel="stylesheet" href="stylesheets/style-okrojone.css"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 

 
</head> 
 

 
<body> 
 
    <div class="cotainer"> 
 
     <div class="parent"> 
 
      <div class="child1"><img src="https://i.stack.imgur.com/tbnsI.jpg" alt="grafika-dodatkowa"></div> 
 
      <i class="child2">parent</i> 
 
     </div> 
 
    </div> 
 

 
</body> 
 

 
</html>

答えて

0

問題は、あなたのparentコンテナがフレキシボックスであること、ですが、あなたのchild1position: absoluteを使用しています。 flexboxの要素の絶対位置は、not offically supportedなので使用しないでください。

クロムが正しい方法でレンダリングできるようですが、他のブラウザでは表示されない可能性があります。フレックスボックスと絶対位置を使用しないように、レイアウトを変更するのが最善です。

0

は...あなたはこれがあなたのために働くこれらの追加のスタイル

margin-left: -306px; /* has to be half of the image width */ 
position: absolute; 
bottom: 0; 

とあなたの.child1これらの追加のスタイル

width: 100%; 
left: 0; 

希望を与えるのimg

関連する問題