Jump to content

Borders with Images


Taorluath

Recommended Posts

Here's my problem. I'm trying to display a blog post with a Poster's Name, a Title, and some Content. This is in a <div> tag. I have a folder named 'lines' which contains horizontal and vertical brush-stroke images. The php randomly selects 2 vertical and horizontal lines, and uses them as a pseudo-border. These should stretch to fit the size of the <div> tag. But for some reason, some of the time the <div> is shorter than the text, even though its height is set to "auto". Sometimes it works.

 

Here's the code and two images; one halfway working, and the other is screwed up and too short.

The only difference between the two images is that I refreshed the page in between the two. (Each time I refresh the page, it changes.)

 

h2 {line-height:30%}
div#post {height:auto; width:30%; position:absolute; left:300px; background-color:red;}
#content {position:absolute; z-index:1; padding:17% 12% 9% 12%; font-size:70%; clear:none}
#right {width:8%; height:90%;  position:relative; top:7%; float:right}
#left {width:8%; height:90%; position:auto; top:7%; float:left}
#top {width:100%; height:5%; position:inherit; float:left;}
#bottom {width:100%; height:5%; position:relative; float:left }
#spacer {width:100%; height:9px; display:block; margin-left:auto; margin-right:auto; }
#content {position:absolute; z-index:1; padding:5% 12% 9% 12%; font-size:110%; clear:none}

<?php
$v1 = "/lines/v".rand(1,15).".png";
$v2 = "/lines/v".rand(1,15).".png";

$h1 = "/lines/h".rand(1,10).".png";
$h2 = "/lines/h".rand(1,10).".png";


?>
<html><head>
<style>
@import "main.css";
</style></head>
<body>
<div id="post">
<center><h1>Andrew</h1></center>
<div id="main">
<img src="<?php echo "/lines/h".rand(1,10).".png"; ?>"  id="top" />
<img src="<?php echo "/lines/v".rand(1,15).".png"; ?>" id="left" />
<img src="<?php echo "/lines/v".rand(1,15).".png"; ?>" id="right" alt="right" />
<div id="content">
<br /> <h2>Test Post</h2> 
<img src="<?php echo "/lines/h".rand(1,10).".png"; ?>"  id="spacer" /><br />
THis is a test..... LAH ALHA LHA. aasdfssdffd asdf  ddddd adsfasdfas  sdfsdafwswfdsasdf sdafasdf sadfa sad fsdf sdddf dfd fdf dsafasdfahhrtgfg jvcbn hjhj h jkl;hkjh kjh kjadsf sdf sd fs df a dsf asdf dsaf dsfsakdfjksdf d skfjsakdf
</div>
<img src="<?php echo "/lines/h".rand(1,10).".png"; ?>" id="bottom"  />
</div>
</div

</body>
</html>

 

[attachment deleted by admin]

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.