Hi,
Because the image is in the background of the div the content will overwrite it unless you make alllowances. Therefore you will need to place the content appropriately using margin/padding etc.
Here is one solution:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin: 0px;
background-color: #e7f5db;
color:#000;
font-family: "Trebuchet MS";
font-size: 12px;
text-align:center;
}
div {text-align:left}
.border {
background-image: url(http://layla.sian.net/csstest/dotted_border.gif);
background-repeat: no-repeat;
padding: 0px;
height: 394px;
width: 546px;
margin-right: auto;
margin-left: auto;
background-position: left top;
}
.text {
text-align: left;
padding:20px;
}
.text p {margin:0px;}
#header {text-align:center}
-->
</style>
</head>
<body>
<div id="header"><img src="<A href='http://layla.sian.net/csstest/header_story.gif">http://layla.sian.net/csstest/header_story.gif"></div>
<div class="border">
<div class="text"><p>Lorem ipsum dolor sit amet, consectetuer adipiscing
elit. Morbi sit amet arcu. Mauris suscipit, magna pharetra dapibus malesuada,
ligula elit eleifend justo, sed aliquet diam erat eget wisi. Aenean mollis
scelerisque ligula. Ut turpis. Nulla bibendum. Duis nulla. Suspendisse suscipit
elit eget diam. Vivamus nec libero. Praesent eget magna sed velit faucibus
ornare. Nulla vehicula tellus ac arcu. Donec diam enim, nonummy ac, nonummy
at, gravida a, lorem. Class aptent taciti sociosqu ad litora torquent per
conubia nostra, per inceptos hymenaeos. Cum sociis natoque penatibus et magnis
dis parturient montes, nascetur ridiculus mus. Mauris consectetuer tellus
vel nisl. Mauris fermentum, felis vestibulum sagittis aliquet, risus tortor
imperdiet tellus, eget porta nunc mi sit amet quam. Morbi vitae lacus vitae
leo feugiat auctor. Donec laoreet lobortis nisl. Integer rutrum nunc at arcu.
Mauris faucibus mi in nunc. Vivamus augue ligula, rhoncus at, vestibulum vitae,
condimentum dignissim, leo. Fusce ullamcorper dui non enim. Suspendisse potenti.
Curabitur viverra lobortis ligula. Etiam blandit auctor elit. Cras erat ipsum,
auctor id, cursus at, aliquet id, augue. Pellentesque habitant morbi tristique
senectus et netus et malesuada fames ac turpis egestas. Integer ut justo at
wisi volutpat consequat. Mauris sapien diam, malesuada ut, venenatis vitae,
tempor ac, urna. Ut porta nulla in turpis. Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nulla nunc. Etiam rutrum vestibulum diam. Suspendisse potenti.
</p></div>
</div>
</body>
</html>
Of course because you are using a background image as a border you will have to make sure that the content always fits as the border won't expand.
If you intend having variable lengths of text within a border the a better solution would be simply to border the text using border:10px dashed #000;. Then just make the little arrow as a separate image and place it in the correct place to overlay the top right border etc.
In this way the border will stretch around the length of the text and you need only specify the width of the container.
Hope this helps.
Paul
Bookmarks