Jump to content

[SOLVED] Add text to div tag


Maq

Recommended Posts

I want to add white text to this border.

 

I have a div tag that creates a 10px border along the top of my page:

 

div.top {
clear: both;
width: 955px;
height: 110px;
position: relative;
border-top: 10px #0054a6 solid;
}

 

I tried to add this line but it didn't work and it's also not supported by all browsers.

 

content: "This is my text";

 

I don't use CSS often, any help is appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/143719-solved-add-text-to-div-tag/
Share on other sites

Oh I see the problem.

 

Since you have a top border it creates an area you cant place text as far as I know.

 

Think of it as a watermelon skin, you cant place the fruit there, but within the melon. right...

 

Instead of having the property having a border, create 1 div that has a background property and is 10px tall with your text, then another div under it that is 100px tall.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.