Maq Posted February 4, 2009 Share Posted February 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/143719-solved-add-text-to-div-tag/ Share on other sites More sharing options...
deadlyp99 Posted February 4, 2009 Share Posted February 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/143719-solved-add-text-to-div-tag/#findComment-754123 Share on other sites More sharing options...
haku Posted February 4, 2009 Share Posted February 4, 2009 That's right. You can't put text inside the border. You will need to fake a border with one div, then have another one inside that that contains your text. Quote Link to comment https://forums.phpfreaks.com/topic/143719-solved-add-text-to-div-tag/#findComment-754453 Share on other sites More sharing options...
Maq Posted February 4, 2009 Author Share Posted February 4, 2009 K, thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/143719-solved-add-text-to-div-tag/#findComment-754466 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.