2016-04-03 6 views
6

मुझे नीचे दी गई तस्वीर में दिखाया गया नीला/हरा क्षेत्र बनाना होगा। यह कोणों को एक बिंदु पर नीचे आ रहा है जिसमें थोड़ा वक्र है।घुमावदार निचले तल के साथ शीर्षलेख

सीएसएस का उपयोग करके इसे प्राप्त करने का सबसे अच्छा तरीका क्या है? IE9 समर्थन संभव नहीं है, तो मुझे IE9 + या IE10 + का समर्थन करने की आवश्यकता है।

मैं शुरू कर दिया है एक बुनियादी demo here - (bluey-हरे-भरे क्षेत्र में दी गई सामग्री की आवश्यकता नहीं है)

header with curved pointed bottom

उत्तर

4

यहाँ केवल सीएसएस के साथ अपने प्रयास है:

.header { 
    background: #415d67; 
    height: 150px; 
    position: relative; 
    z-index: 1; 

} 
.header:after { 
    position: absolute; 
    content: ""; 
    background: #415d67; 
    width: 50%; 
    bottom: -20px; 
    right: 0; 
    height: 100%; 
    transform: skewY(-5deg); 
    transform-origin: right; 
    border-bottom-left-radius: 50px; 
    padding-right: 44px; 
    z-index: -1; 
} 
.header:before { 
    position: absolute; 
    content: ""; 
    background: #415d67; 
    width: 50%; 
    bottom: -20px; 
    left: 0; 
    height: 100%; 
    transform: skewY(5deg); 
    transform-origin: left; 
    border-bottom-right-radius: 50px; 
    padding-left: 44px; 
    z-index: -1; 
} 
.content { 
    background: white; 
    padding: 20px; 
    padding-top: 100px; 
} 

JSBIN demo

आप एक एसवीजी ग्राफ़िक का उपयोग करने पर भी विचार कर सकते हैं।

+0

निम्न उदाहरण नीचे वक्र के लिए एक बेज़ियर वक्र कमांड के साथ एक path element का उपयोग करता है Awsome अच्छी तरह से काम करने लगता है। धन्यवाद! केवल एक चीज थी कि मैं बूटस्ट्रैप का उपयोग कर रहा हूं और जोड़ने के लिए जरूरी है: 'बॉक्स-साइजिंग: प्रारंभिक' 'हैडर: बाद' और '.header: बूटरस्ट्रैप के रूप में कक्षाओं से पहले' बॉक्स-आकार का उपयोग कर रहा था: सीमा-बॉक्स; 'जो बिंदु कर्ल बना दिया। – ifusion

3

एक और दृष्टिकोण inline svg का उपयोग करना होगा।

#header { 
 
    position: relative; 
 
    padding: 30px; 
 
    text-align: center; 
 
    color: #fff; 
 
} 
 
#header svg { 
 
    position: absolute; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    height: 100%; 
 
    z-index: -1; 
 
}
<div id="header"> 
 
    <svg viewbox="0 0 100 20" preserveAspectRatio="none"> 
 
    <path fill="#415D67" d="M0 0 H100 V10 L52.5 19.5 Q50 20 47.5 19.5 L0 10z" /> 
 
    </svg> 
 
    <p>Some content</p> 
 
</div> 
 
<p>some more content</p>

+1

आह अच्छा, एक और अच्छा तरीका :) धन्यवाद! – ifusion

1

रेखीय-ढाल उपयोगी भी हो सकता है: http://codepen.io/gc-nomade/pen/reYWxd

.header { 
 
    background: linear-gradient(to bottom left, #415D67 50%, transparent 51%) bottom left no-repeat, linear-gradient(to bottom right, #415D67 50%, transparent 51%) bottom right no-repeat, linear-gradient(to left, #415D67, #415D67) top no-repeat; 
 
    background-size: 50.1% 30%, 50.1% 30%, 100% 70%; 
 
    height: 105px; 
 
    padding-bottom: 45px; 
 
    /* other makeup from here */ 
 
    display: flex; 
 
} 
 
h1 { 
 
    margin: auto; 
 
    color: turquoise; 
 
    text-shadow:0 0 white; 
 
} 
 
.content { 
 
    background: white; 
 
    padding: 0.25em 20px 20px; 
 
}
<div class="header"> 
 
    <h1>whatever stands here</h1> 
 
</div> 
 
<div class="content"> 
 
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque quia dicta fuga porro esse enim rem laudantium velit dolore doloremque. Esse, voluptatem, consequatur. Rem error unde esse. Architecto, ad, blanditiis. 
 
</div>

संबंधित मुद्दे