...

View Full Version : Rusty CSS :-)



bgareth
11-21-2012, 06:53 PM
Hello,

Please could someone check the following code and give me some feedback on it. I'm very rusty on my CSS and I just about managed to put something together that worked. Please can you explain any feedback to me in a straight forward way as a newbie :-)

I've included the rest of the code so you can see where I have called the dividers. I suspect I have deployed the box model properly missing out "border".

Thanks and Kind Regards,

BG.


<!DOCTYPE html>
<html lang="en">
<head>
<title>Great Britain Holiday Checker Tool</title>

<!-- Inline CSS -->

<style>

/* Left Blue Border */

#borderleft {
margin-top:1px;
margin-left:2px;
height:95%;
width:8%;
background-color:blue;
position:absolute;
}

/* Top Blue Border */

#bordertop {
margin-top:1px;
margin-left:2px;
height:10%;
width:95%;
background-color:blue;
position:absolute;
}

#head {
padding-top:5%;
padding-left:27%;
position:absolute;
}


#body {
padding-top:10%;
padding-left:20%;
position:absolute;
}


/* Collaborative Header CSS */

h1 {text-align:center; color:black; font-family:"Arial", Calibri, "sans-serif";}

/* Collaborative Paragraph CSS */

p {margin-left: 20px; font-family:"Arial", "Calibri", "sans-serif"; color:blue;}

</style>
</head>
<body>

<!-- Top Border Call -->

<div id="bordertop">
<p><a>
</div>


<!-- Left Border Call -->

<div id="borderleft">
<p>a</p>
</div>

<!-- Head Divider Call -->

<div id="head">
<h1>Great Britain Holiday Checker Tool</h1>
</div>

<!-- Body Divider Call -->

<div id="body">

<?php

/* Variable declarations */

$weekday = date("D");
$od = date("S");
$day = date("d");
$month = date("M");
$year = date("Y");
$hour = date("H");
$minute = date("i");
$seconds = date("s");

/* Multidimensional array for holidays - Christmas will be added later. */

$holidays = array( array("Boxing_Day", 2612),
array("Easter_Monday", 0104),
array("Good_Friday", 2903),
array("January_2nd", 0201),
array("May_Day_Holiday", 0605),
array("New_Year's_Day", 0101),
array("New_Year's_Eve", 3112),
array("Orangeman's_Day", 1207),
array("Saint_Patrick's_Day", 1703),
array("Spring_Bank_Holiday", 2705),
array("St_Andrew's_Day", 3011),
array("Summer_Bank_Holiday_Scotland", 0508),
array("Summer_Bank_Holiday_ENIW", 2608),
);

/* Display current time and date */

echo "<p>The time when you loaded this page was: {$hour}:{$minute}:{$seconds} GMT and the date was {$weekday}, {$day}{$od} {$month} {$year}.</p>
<p>I haven't learnt Javascript yet so I can't set it to auto-update without using meta-refresh.</p>";

/* To determine whether it is Christmas Eve the following day and if so to display a message after 7pm on 23 December. */

if ($day == 23 and $month == 12 and $hour > 19)
{
echo "<p>Christmas Eve is tomorrow.</p>";
}

/* To determine whether it is Christmas Day the following day and if so to display a message after 7pm on 24 December. */

elseif ($day == 24 and $month == 12 and $hour > 19)
{
echo "<p>Christmas Day is tomorrow.</p>";
}

/* Message to display if it is neither Christmas Eve or Christmas Day the following day. */

else
{
echo "<h1>Today is not a holiday. Tomorrow isn't either.</h1>";
}

?>

</div>
</body>
</html>

Excavator
11-21-2012, 08:17 PM
Hello bgareth,
You use absolute positioning without positioning anything. There is no real need for ap in this layout yet, it could work fine if you just let the document flow naturally instead.


Look at it like this -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
height: 100%;
font: 100% "Trebuchet MS", Arial, Helvetica, sans-serif;
color: #000;
background: #fff;
}
#column {
height: 90%;
width: 5%;
float: left;
background: #00f;
}
#container {
width: 90%;
margin: 0 0 0 5%;
overflow: auto;
background: #00f;
}
#content {
margin: 5% 0 0;
padding: 5%;
background: #fff;
}
</style>
</head>
<body>
<div id="column"></div>
<div id="container">
<div id="content">

<?php

/* Variable declarations */

$weekday = date("D");
$od = date("S");
$day = date("d");
$month = date("M");
$year = date("Y");
$hour = date("H");
$minute = date("i");
$seconds = date("s");

/* Multidimensional array for holidays - Christmas will be added later. */

$holidays = array( array("Boxing_Day", 2612),
array("Easter_Monday", 0104),
array("Good_Friday", 2903),
array("January_2nd", 0201),
array("May_Day_Holiday", 0605),
array("New_Year's_Day", 0101),
array("New_Year's_Eve", 3112),
array("Orangeman's_Day", 1207),
array("Saint_Patrick's_Day", 1703),
array("Spring_Bank_Holiday", 2705),
array("St_Andrew's_Day", 3011),
array("Summer_Bank_Holiday_Scotland", 0508),
array("Summer_Bank_Holiday_ENIW", 2608),
);

/* Display current time and date */

echo "<p>The time when you loaded this page was: {$hour}:{$minute}:{$seconds} GMT and the date was {$weekday}, {$day}{$od} {$month} {$year}.</p>
<p>I haven't learnt Javascript yet so I can't set it to auto-update without using meta-refresh.</p>";

/* To determine whether it is Christmas Eve the following day and if so to display a message after 7pm on 23 December. */

if ($day == 23 and $month == 12 and $hour > 19)
{
echo "<p>Christmas Eve is tomorrow.</p>";
}

/* To determine whether it is Christmas Day the following day and if so to display a message after 7pm on 24 December. */

elseif ($day == 24 and $month == 12 and $hour > 19)
{
echo "<p>Christmas Day is tomorrow.</p>";
}

/* Message to display if it is neither Christmas Eve or Christmas Day the following day. */

else
{
echo "<h1>Today is not a holiday. Tomorrow isn't either.</h1>";
}

?>
<!--end content--></div>
<!--end container--></div>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum