Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Float and Clear Problems
Old 02-13-2006, 02:03 PM Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
I have used the float function and have a page layout that works.

To center the image it is set as a none repeating background, this is done as the menu makes the image go off center, putting it as a background solves this problem.

The page has a footer which at the moment appears over the background image, it won't clear it.

It is possible to clear a background image in css?

I have only used float and clear once before and then I did not used a footer, so I did not have this problem.
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
 
Register now for full access!
Old 02-13-2006, 02:31 PM Re: Float and Clear Problems
karinne's Avatar
Extreme Talker

Posts: 197
Location: Quebec, Canada
Trades: 0
Before your footer add

HTML Code:
<br style="clear: both;" />
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Getting on the Web Standards band-wagon? Get these books -
Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE


Takin' in the view from the outside. Feeling like the underdog. Watching through the window I'm on the outside. Living like the underdog.
-Dream Theater
karinne is offline
Reply With Quote
View Public Profile Visit karinne's homepage!
 
Old 02-13-2006, 02:36 PM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
Nope that don't work!

I did try that even though the CSS is in a seprate file.
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-13-2006, 02:45 PM Re: Float and Clear Problems
karinne's Avatar
Extreme Talker

Posts: 197
Location: Quebec, Canada
Trades: 0
do you have a link then?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Getting on the Web Standards band-wagon? Get these books -
Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE


Takin' in the view from the outside. Feeling like the underdog. Watching through the window I'm on the outside. Living like the underdog.
-Dream Theater
karinne is offline
Reply With Quote
View Public Profile Visit karinne's homepage!
 
Old 02-13-2006, 02:52 PM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
No Sorry.

HTML File - some HEAD content removed
Code:
<?xml version="1.0"?>
<!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" lang="en">
<head>
<title>TITLE REMOVED</title>
<link rel="Stylesheet" type="text/css" href="styles.css" />

<meta name="generator" content="NoteTab Light 4.91" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="content">


<class id="header">
<h1>Website Title</h1>
<hr />
</div>

<div id="menu">
<ul>
<li><a href="index.html">Home Page</a></li>
<li><a href="#">menu item 1</a></li>
<li><a href="#">menu item 2</a></li>
<li><a href="#">menu item 3</a></li>
<li><a href="#">menu item 4</a></li>
<li><a href="#">menu item 5</a></li>

</ul>
</div>

<div id="footer">
<h2>
<hr />
Footer goes here
<hr />
</h2>
</div>


</div>


</body>
</html>
And the CSS file

Code:
p {
color : black; 
font-family : verdana, "times new roman"; 
} 

h1 {
font-family : verdana, "times new roman"; 
} 

a {
text-decoration : none; 
font-family : verdana, "times new roman"; 
} 

a:link {
color : #f5deb3; 
} 

a:visited {
color : #f5deb3; 
} 

a:hover {
text-decoration : underline; 
color : red; 
} 


#menu {
background-color : #008000;
float : left; 
clear : both;
} 

#main {
margin-left : 250px; 
} 

h1 {
text-align: center;
font-family : verdana, "times new roman"; 
} 

h2 {
clear : both;
text-align: center;
font-family : verdana, "times new roman"; 
} 

body {
background: #f5deb3 url('folder/file.gif') no-repeat fixed center; 
}
 
hr {
width:80%;
}

#footer {
clear: both;
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-13-2006, 03:12 PM Re: Float and Clear Problems
karinne's Avatar
Extreme Talker

Posts: 197
Location: Quebec, Canada
Trades: 0
OK... well... depending on the resolution, you can't really fix the footer thing over the background the way you have it set up as a background to body { }

I would one div with the image as a background then have menu divs floating over that one.

something like

CSS
HTML Code:
p {
color : black; 
font-family : verdana, "times new roman"; 
} 

h1 {
font-family : verdana, "times new roman"; 
} 

a {
text-decoration : none; 
font-family : verdana, "times new roman"; 
} 

a:link {
color : #f5deb3; 
} 

a:visited {
color : #f5deb3; 
} 

a:hover {
text-decoration : underline; 
color : red; 
} 


#menu {
background-color : #008000;
float : left; 
}

#main {
margin-left : 250px; 
} 

h1 {
text-align: center;
font-family : verdana, "times new roman"; 
} 

h2 {
clear : both;
text-align: center;
font-family : verdana, "times new roman"; 
} 

body {
background: #f5deb3; 
}
 
hr {
width:80%;
}

#footer {
clear: both;
}

#wrap {
  background: url('folder/file.gif') no-repeat fixed center; 
}
removed the "clear: both" you had for #menu

HTML
HTML Code:
<?xml version="1.0"?>
<!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" lang="en">
<head>
<title>TITLE REMOVED</title>
<link rel="Stylesheet" type="text/css" href="styles.css" />

</head>
<body>
<div id="content">


<class id="header">
<h1>Website Title</h1>
<hr />
</div>

<div id="wrap">

<div id="menu">
<ul>
<li><a href="index.html">Home Page</a></li>
<li><a href="#">menu item 1</a></li>
<li><a href="#">menu item 2</a></li>
<li><a href="#">menu item 3</a></li>
<li><a href="#">menu item 4</a></li>
<li><a href="#">menu item 5</a></li>

</ul>
</div>

</div>

<div id="footer">
<h2>
<hr />
Footer goes here
<hr />
</h2>
</div>


</div>


</body>
</html>
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Getting on the Web Standards band-wagon? Get these books -
Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE


Takin' in the view from the outside. Feeling like the underdog. Watching through the window I'm on the outside. Living like the underdog.
-Dream Theater

Last edited by karinne; 02-13-2006 at 03:19 PM..
karinne is offline
Reply With Quote
View Public Profile Visit karinne's homepage!
 
Old 02-13-2006, 03:54 PM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
That seems to have worked but the image won't display at all.

Will look again later.
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-13-2006, 04:01 PM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
No image just won't display at all.

Using your exact code above (only change I made was the image name back to the orignal file)
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-14-2006, 07:19 AM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
Any ideas anyone, image just won't display using code in #6
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-14-2006, 09:08 AM Re: Float and Clear Problems
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
the div with the image has no height so how would you see the background?

Put borders on it to see where it is and how big it is(n't)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-14-2006, 01:32 PM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
The image is set in the Style Sheet

Code:
#wrap {
  background: url('folder/file.gif') no-repeat fixed center; 
}
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-14-2006, 04:01 PM Re: Float and Clear Problems
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
yep it is, still doesn't have a height.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-14-2006, 10:12 PM Re: Float and Clear Problems
angele803's Avatar
Perfectly Imperfect

Posts: 1,774
Name: Stephanie
Location: Oklahoma
Trades: 2
When you have a background image, you either have to set a height, or you have to have some kind of content in the div for the image to show up. It took me a while to figure that one out.
__________________

Please login or register to view this content. Registration is FREE
angele803 is offline
Reply With Quote
View Public Profile
 
Old 02-17-2006, 09:20 AM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
Excellent

I have put a height tag in.

Seems to be working now.

If I set height in the CSS to 50% will that center it on any screen res?
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-17-2006, 10:26 AM Re: Float and Clear Problems
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
Problem is it won't work in FireFox!

It does in IE though perfect.
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
Old 02-17-2006, 10:33 AM Re: Float and Clear Problems
karinne's Avatar
Extreme Talker

Posts: 197
Location: Quebec, Canada
Trades: 0
Do you have this online now? It would really help
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Getting on the Web Standards band-wagon? Get these books -
Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE


Takin' in the view from the outside. Feeling like the underdog. Watching through the window I'm on the outside. Living like the underdog.
-Dream Theater
karinne is offline
Reply With Quote
View Public Profile Visit karinne's homepage!
 
Reply     « Reply to Float and Clear Problems
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41151 seconds with 12 queries