Author Topic: Div problems  (Read 6249 times)

0 Members and 1 Guest are viewing this topic.

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Div problems
« Reply #15 on: March 08, 2011, 02:38:39 pm »

Code: [Select]
<html>
<head>
<title>Magic 8 Ball</title>
<script type="text/JavaScript">
function answer()
{
now = new Date();
num = now.getSeconds() % 16;
document.ans.src=("gr/pic" + num + ".png");
}

function check()
{
if (document.ask.question.value.length == 0)
{
alert("Please enter a question!");
document.ask.question.focus;
}
else
{
answer();
}
}
</script>
<style type="text/css">
body {background-image:url('8ball.png');
background-repeat:no-repeat;
background-position:left top;
}
.pies {font-family:Arial;
font-size:22px;
}
div#ball{background-image:url('gr/ball.png');
position:relative;
width:600;
height:600;
z-index:1;
}
div#reply{
margin-top: 210px;
z-index:2;
}
#main{
background-image: url(gr/ball.png);
background-repeat: no-repeat;
height: 700px;
width: 600px;
background-color: #777777;
border: medium solid #444444;
padding: 15px;
background-position: top;
}
</style>
</head>
<body bgcolor="#aaaaaa">

<center>
<div id="main">

<div id="reply"><img src="gr/nothing.png" name="ans"></div>

<br>
<form name="ask" style='margin-top: 260px'>
What is your question?<br>
<input type="text" name="question" size="45"><br>
<input type="button" value="Shake!" onMouseDown="check()">
</form>
<br>

</div></center>

</body>
</html>

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Div problems
« Reply #16 on: March 09, 2011, 09:22:59 am »
margin: 0 auto should center a div.




Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Div problems
« Reply #17 on: March 09, 2011, 10:40:04 am »
Ive tried that but it only works in relative positioning, which i can already do with html. :(

And thx Aichi :D
« Last Edit: March 09, 2011, 10:40:54 am by Broseph Radson »