Welcome to Dream.In.Code
Become an Expert!

Join 150,421 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,109 people online right now. Registration is fast and FREE... Join Now!




Creating a Status Bar using CSS

 
Reply to this topicStart new topic

Creating a Status Bar using CSS

RodgerB
29 Mar, 2008 - 12:09 AM
Post #1

D.I.C Lover
Group Icon

Joined: 21 Sep, 2007
Posts: 2,166



Thanked: 17 times
Dream Kudos: 2200
Expert In: Dot Net Technologies

My Contributions
Today I decided I'd have a play in CSS, as I am kinda noob at Web Design and wanting to expand my horizons. I was planning on making a status bar kind of thing, where some text would expand over the whole bottom of the window, displaying the time and other not needed text.

The code I have used is shown here (without the rest of the garbage I plan to use):

HTML
<html>

<head>
<style type="text/css">
div.statusBar { position:fixed ; left:0% ; top:95% ; background: gray }
</style>
</head>

<body>
<div class="statusBar">Hello</div>
</body>

</html>


The questions I have are, how I would I go about making this expand the whole width of the browser document for all browsers and have it at the correct height in all browsers?

Thanks in advance smile.gif.
User is online!Profile CardPM
+Quote Post

thehat
RE: Creating A Status Bar Using CSS
29 Mar, 2008 - 02:53 AM
Post #2

D.I.C Head
Group Icon

Joined: 28 Feb, 2008
Posts: 217


Dream Kudos: 100
My Contributions
Unless I'm missing, something can't you just use width:100%; height:50px; in your css? If you're wanting it to expand on user interaction then you're gong to need javascript;
User is offlineProfile CardPM
+Quote Post

RodgerB
RE: Creating A Status Bar Using CSS
29 Mar, 2008 - 06:45 AM
Post #3

D.I.C Lover
Group Icon

Joined: 21 Sep, 2007
Posts: 2,166



Thanked: 17 times
Dream Kudos: 2200
Expert In: Dot Net Technologies

My Contributions
Thanks for your help, I set the width attribute to 100%, something I didn't think of previously. I understood the need for javascript however, and for those interested this is what I wanted to make, I did so in a couple of hours panning through why it wouldn't work in Firefox, then it would work in IE etc.

HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Woot</title>

<script type="text/javascript">
var timer = null;

window.onload = function() {
showDateTime();
timer = setInterval('showDateTime()', 1000);
}
function showDateTime() {
var date = new Date();
document.getElementById('timeDate').innerHTML = date.toString();
clearInterval(timer);
timer = setInterval('showDateTime()', 1000);
}
</script>

<style type="text/css">

div.statusBar {
position:fixed ;
left:0% ;
top:97.9% ;
background: silver;
width: 100% ;
text-align:right }
}
</style>

</head>

<body>
<div class="statusBar" id="timeDate"></div>
</body>
</html>


Thanks a lot! Now the only issue I am having is the status bar's height gradually decreases when the browser window has shrunk vertically, but I'm sure I don't care tongue.gif! wink2.gif

Now all I need is an idea to use it with. sad.gif XD
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:22PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month