如何使用html和css实现此标头?

时间:2014-06-10 12:00:36

标签: html css asp.net html5 css3

我正在尝试在我的网站中设计这种标题(如附图中所示)并没有成功,任何人都可以帮忙吗?

标题我正在尝试设计

enter image description here

Web site with this header

3 个答案:

答案 0 :(得分:3)

我创造了这个:

<强> HTML

<h1 class="ribbon">
   <strong class="ribbon-content">CAPTURE|WEDDING PHOTOGRAPHY</strong>
</h1>

<强> CSS

.ribbon {
 font-size: 16px !important;
 /* This ribbon is based on a 16px font side and a 24px vertical rhythm. I've used em's to position each element for scalability. If you want to use a different font size you may have to play with the position of the ribbon elements */
 width: 50%;    
 position: relative;
 background: #ffffff;
color: rgb(134, 152, 158);
 text-align: center;
 padding: 1em 2em; /* Adjust to suit */
 margin: 2em auto 3em; /* Based on 24px vertical rhythm. 48px bottom margin - normally 24 but the ribbon 'graphics' take up 24px themselves so we double it. */
}
.ribbon:before, .ribbon:after {
 content: "";
 position: absolute;
 display: block;
 bottom: -1em;
 border: 1.5em solid #fff;
 z-index: -1;
}
.ribbon:before {
 left: -2em;
 border-right-width: 1.5em;
 border-left-color: transparent;
}
.ribbon:after {
 right: -2em;
 border-left-width: 1.5em;
 border-right-color: transparent;
}
.ribbon .ribbon-content:before, .ribbon .ribbon-content:after {
 content: "";
 position: absolute;
 display: block;
 border-style: solid;
 border-color: #000000 transparent transparent transparent;
 bottom: -1em;
}
.ribbon .ribbon-content:before {
 left: 0;
 border-width: 1em 0 0 1em;
}
.ribbon .ribbon-content:after {
 right: 0;
 border-width: 1em 1em 0 0;
}

fiddle

您可以使用颜色大小等。

css的来源:css ribbon

答案 1 :(得分:1)

这是功能区

了解这一点,您可以专注于Google search并获得惊人的效果:

享受

答案 2 :(得分:0)

如果您主要关注的是在HTML中创建像边一样的功能区,这将对您有所帮助,

http://webdesign.tutsplus.com/articles/how-to-create-a-modern-ribbon-banner-navigation-bar-with-pure-htmlcss3--webdesign-2728