4

I need the css code to create the following box:

box with header

This is my approach:

.content-box-gray {
margin: 0 0 0px;
overflow: hidden;
padding: 10px;
height: 15px;
font-size: 15px;
border-radius: 5px;
border: 1px solid gray;
color: #3385FF;
}

Now i need to code the header..

Regards,

Egidi
  • 1,736
  • 8
  • 43
  • 69

2 Answers2

4

DEMO

MARKUP:

<figure></figure>

STYLE:

figure{
    width:400px;
    height:220px;
    border-radius:4px;
    border:2px solid #ccc;
    position:relative;
}

figure:before{
    content:'';
    position:absolute;
    top:40px;
    left:0;
    width:100%;
    height:2px;
    background:#ccc;
}

RESULT:

Dealing with FIGURE element

UPDATE @petermeissner

if you want to add a tittle and a body, you can use content: attr(data-title);

figure{
    width:400px;
    height:220px;
    border-radius:4px;
    border:2px solid #ccc;
    position:relative;
    padding:48px 10px 10px
}

figure:before {
    content: attr(data-title);
    position: absolute;
    top: 0px;
    left: 0;
    width: 100%;
    height: 40px;
    line-height: 40px;
    text-indent: 10px;
    border-bottom: 2px solid #ccc;
}
<figure data-title="Butter Cookies!">
  <figcaption>
    Homemade vanilla Danish butter cookies are the perfect cookie to share!         <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure">find out more about this Figure</a>
  </figcaption>
</figure>

RESULT:

enter image description here

Gildas.Tambo
  • 22,173
  • 7
  • 50
  • 78
3

Please check this. Check this [fiddle]: http://jsfiddle.net/8L6ucojp/1/

.content-box-gray .content {
    overflow: hidden;
    padding: 10px;
    font-size: 15px;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    border: 1px solid gray;
    color: #3385FF;
}
.content-box-gray .title {
    height:30px;
    line-height:30px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    background:gray;
    font-size:18px;
    font-weight:bold;
    font-family:verdana;
    display:block;
    color:white;
    display:block;
    padding:10px;
    border: 1px solid gray;
    border-bottom:none;
}

And html as follows

<div class="content-box-gray ">
    <div class="title">This is heading.</div>

    <div class="content">this is content . lots of content.</div>
</div>
Ganesh Nemade
  • 1,504
  • 12
  • 17