Bailey123 Bailey123 - 2 years ago 141
CSS Question

How to add text within a block element

A very stupid question I'm sure so sorry guys I'm very new to all of this.

I've to put h1-h4 inside four "box" block elements. I've put in h1 right next to the body tag but its showing up outside the box and not in. I've been playing around on sublime and looking it up on google but cant seem to figure out the answer. I know its something so simple yet I'm being so stupid lol

any help would be much appreciated.

Answer Source

I asume that "box" means div, so if you want to put some H1, H4 in a div, just make it like this :

<div class='myBox'>
    <h1>Hello World</h1>
    <h4>i'm glad to be here</h4>
</div>

And to be sure your h1, h4 element are in the div, put the following CSS code :

.myBox {
    border: solid 1px orange;
}

I hope it could help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download