Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-21-2012, 05:53 PM   PM User | #1
bgareth
New Coder

 
Join Date: Sep 2011
Location: Bournemouth
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
bgareth is an unknown quantity at this point
Rusty CSS :-)

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.

Code:
<!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>
bgareth is offline   Reply With Quote
Old 11-21-2012, 07:17 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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 -
Code:
<!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>
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Reply

Bookmarks

Tags
colour blocks, css, dividers

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:34 AM.


Advertisement
Log in to turn off these ads.