2016-03-23 14 views
-1

私はこのHalf CircleCSSセパレータを半円にする方法は?

のようなモックアップがあると私は私のコード

HTML

<section id="screens-three" class="clearfix"> 
    <div class="container"> 
     <div class="row"> 
      <div class="col-md-12"> 
       <h1 class="maintitle text-center">Test</h1> 
      </div> 
     </div> 
    </div> 
</section> 

<section id="screens-four" class="clearfix"> 
    <div class="container"> 
     <div class="row"> 
      <div class="col-md-12"> 
       <h2 class="maintitle">01Designs</h2> 
      </div> 
     </div> 
    </div> 
</section> 

問題でこれを追加しようとしていますか?上の画像のようにセパレータを作るには?

+4

どのCSSを試しましたか? – Xufox

+0

できません(実際には半円ではありませんが、半円形ではありません)。イメージを使用します。 –

+0

問題は左と右の丸い角です(Bhojendraが言ったことです)。しかし、単純な半円のようなものは可能です(http://stackoverflow.com/questions/18033468/how-to-add-a-half-circle-at-the-bottom-middle-of-my-header) 。 – Marvin

答えて

0

あなたの画像と全く同じように作成することはできません。このためには、imageを使用してセパレータのスタイルを設定する必要があります。

半円形の場合

、あなたが使用することができます。

.separator { 
 
    position: relative; 
 
    background: #000; 
 
    height: 50px; 
 
} 
 

 
.separator::before{ 
 
    width: 30px; 
 
    height: 15px; /* half of the width */ 
 
    border-bottom-left-radius: 15px; 
 
    /* play with the value like 10px 12px 
 
     to get something like your image */ 
 
    border-bottom-right-radius: 15px; 
 
    border-top: 0; 
 
    content: ""; 
 
    position: absolute; 
 
    left: 50%; 
 
    top: 0px; /* use negative shift if you get something closer to image */ 
 
    background-color: #fff; 
 
}
<div class="separator"></div>

+0

'transform'' scale'関数を使用して楕円形にすることができます。 (実際には 'transform:translateX(-50%);'を使用して実際に中心に置くことができます) – Xufox

+0

それでも画像と同じように作成することはできませんでした。 –

0

HTML:

<div class="container"> 
<div class="absolute-div"> 

</div> 
<div class="first-div"> 
</div> 
<div class="second-div"> 
</div> 

CSS:

.first-div 
{ 
    height:50px; 
    background-color:#666; 
} 
.second-div 
{ 
    height:100px; 
    background-color:#000; 
} 
.absolute-div{ 
    height:30px; 
    margin-left:50%; 
    position:absolute; 
    width:30px; 
    margin-top:40px; 
    background:#666; 
    border-radius:50px; 

} 
.container{ 
    position: relative; 
} 

ここでは0です。

+0

これは、希望の形状のようには見えません。 – Xufox

+0

@Xufox:True。しかし、それが私ができる最高です。 –

関連する問題