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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.