Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Box with header

Tags:

css

header

box

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,

like image 422
Egidi Avatar asked Oct 14 '25 02:10

Egidi


1 Answers

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

like image 137
Gildas.Tambo Avatar answered Oct 17 '25 23:10

Gildas.Tambo