OMG DIVS lmao

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

OMG DIVS lmao

Post by Epiales »

I know someone is going to laugh their butts off here, but I've spent a few hours and I can't find what is freakin' wrong with the lining up of the health/experience bars. I see nothing wrong in the code:

Code: Select all

<style>
#stats {
    margin-left:305px;
    background:url(../images/bg.png);
    width:200px;
    height:170px;
    font:bold Arial, Helvetica, sans-serif;
    color:rgb(255, 255, 255);
    color:white;
}

#hpointsback {
    position:relative;
    margin-left:10px;
    z-index:1;
}

#hpoints {
    position:relative;
    margin-left:10px;
    z-index:2;
}

#expback {
    position:relative;
    margin-left:10px;
    z-index:1;
}

#experience {
    position:relative;
    margin-left:10px;
    z-index:2;
}
</style>

Code: Select all

<!-- THIS IS THE HEALTH BAR CODE-->
<?php
$username = $_SESSION["username"];
$sql = "SELECT * FROM users WHERE username='$username' AND activated='1' LIMIT 1";
$user_query = mysqli_query($db_conx, $sql);
// Now make sure that user exists in the table
$numrows = mysqli_num_rows($user_query);
$row = mysqli_fetch_array($user_query, MYSQLI_ASSOC);
?>

<!-- THIS IS THE HEALTH BAR CODE-->
<div id="stats">
    <div id= "hpointsback">
    <?php
    echo "<img src='images/barback1.png'>";
    ?>
    </div>
    <div id= "hpoints">
<?php
$width = ($row['hpoints'] / $row['maxhp']) * 150;
echo "<img src='images/hpoints1.png' width='$width' height='10'>";
?>

<!-- THIS IS THE EXPERIENCE BAR CODE-->
    </div>
    <div id= "expback">
    <?php
    echo "<img src='images/barback1.png'>";
    ?>
    </div>
    <div id= "experience">
<?php
$width = ($row['userexp'] / $row['maxexp']) * 150;
echo "<img src='images/experience.png' width='$width' height='10'>"; ?>
    </div>
</div>
I had everything out of whack on my previous work, I had to start over, and now can't get the bars to hover over one another to make it a progress bar.

EDIT*****************

I also didn't put any margin-top to line them up on top of one another, because it doesn't work. All they do is just go right under one another... they will not overlap grrrr :twisted:
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: OMG DIVS lmao

Post by Epiales »

LOL, I just NOW figured it all our again... grrr. :P :P :P :P :P
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: OMG DIVS lmao

Post by Jackolantern »

Good! Did that jQuery answer in your other thread help?
The indelible lord of tl;dr
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: OMG DIVS lmao

Post by Epiales »

Jackolantern wrote:Good! Did that jQuery answer in your other thread help?
haven't tried to implement it yet, as I have redone things. I will let you know. I'm sure it will though. I"m fighting with making the divs stay in place upon scrolling screen. It all goes out of whack now lmao... it does that to me everytime I try and do anything.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
Post Reply

Return to “Beginner Help and Support”