Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > CSS problem with dynamic banner

Reply
Thread Tools

CSS problem with dynamic banner

 
 
sevillad@gmail.com
Guest
Posts: n/a
 
      07-24-2006
Hi,

I've started to add CSS to my webpage, and I thought I'd be able to add
a nice dynamic title, with one image on the left, another on the right,
and some plain background in the middle (to allow for windows resize).
Well, it doesn't work well and I don't know why... see four yourselves
(css code included in the file):

http://www.cs.concordia.ca/~dsevilla/test.html

With IE6, the image on the right is displaced down, as if there was an
extra end of line somewhere; there shouldn't be, I've tried removing
every space and line end in the code. With Firefox it's even worse, as
the images are not included in the box (see the border?). I'm ready to
give up on such a complicated goal, but first I'd like to see if
someone can help, I'm pretty sure there's something silly I overlooked.
Or maybe some bug I haven't heard of (I've spent many hours looking for
info online).

Thanks in advance,

David

 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      07-24-2006
wrote:
> Hi,
>
> I've started to add CSS to my webpage, and I thought I'd be able to add
> a nice dynamic title, with one image on the left, another on the right,
> and some plain background in the middle (to allow for windows resize).
> Well, it doesn't work well and I don't know why... see four yourselves
> (css code included in the file):
>
> http://www.cs.concordia.ca/~dsevilla/test.html
>
> With IE6, the image on the right is displaced down, as if there was an
> extra end of line somewhere; there shouldn't be, I've tried removing
> every space and line end in the code. With Firefox it's even worse, as
> the images are not included in the box (see the border?). I'm ready to
> give up on such a complicated goal, but first I'd like to see if
> someone can help, I'm pretty sure there's something silly I overlooked.
> Or maybe some bug I haven't heard of (I've spent many hours looking for
> info online).


Not a bug, you are not implementing your floats correctly. Put the
right-floated image *before* the regular flow text "Personal Page" in
the markup.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
sevillad@gmail.com
Guest
Posts: n/a
 
      07-24-2006
Hi,

> Not a bug, you are not implementing your floats correctly. Put the
> right-floated image *before* the regular flow text "Personal Page" in
> the markup.
>
> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIO
> http://www.LittleWorksStudio.com


Thanks a lot, it works perfectly in IE. On the other hand, in Firefox
the extra line is gone but the text+bg does not extend all the way and
is not centered (the orange box doesn't include the images). Is that
also solvable in a simple way? I'd be more than satisfied if those two
browsers can see my page well.

Thanks,

David

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      07-24-2006
wrote:
> Hi,
>
>> Not a bug, you are not implementing your floats correctly. Put the
>> right-floated image *before* the regular flow text "Personal Page" in
>> the markup.
>>
>> --
>> Take care,
>>
>> Jonathan
>> -------------------
>> LITTLE WORKS STUDIO
>> http://www.LittleWorksStudio.com

>
> Thanks a lot, it works perfectly in IE. On the other hand, in Firefox
> the extra line is gone but the text+bg does not extend all the way and
> is not centered (the orange box doesn't include the images). Is that
> also solvable in a simple way? I'd be more than satisfied if those two
> browsers can see my page well.


Well David you have a number of errors that is the cause of your
problems. One of which is your in quirks mode without the doctype and a
few others.

Why are your making DIV title display inline? Removing that helps. Now
to get your title DIV to wrap around the floated images your have three
options I can think of:

1) Explicitly define the 'height' of 'title'
2) Use a clearing element (as you are doing but you are missing the
definition of your 'clearer' class)
3) Make overflow of 'title' DIV auto


CODE try it and see:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>CSS test</title>

<style type="text/css">
#main {width: 100%;}
body {background-color: #999999; margin: 0; padding: 0; }
#bannerleft {float: left; }
#bannerright {float: right; }

#title {
border: 3px coral solid;
width: 100%;
color: blue;
background: #000000 url(arn.gif) repeat-x;
font-size: 35px;
text-align: center;
overflow: auto;
}
</style>

</head>
<body>

<div id="main">
<div id="title">
<img src="test_files/b-l.gif" id="bannerleft" height="90" width="60">
<img src="test_files/b-r.gif" id="bannerright" height="90" width="60">
Personal Page

</div>

</div>

</body></html>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
sevillad@gmail.com
Guest
Posts: n/a
 
      07-24-2006
Hi,

I didn't add a doctype because I didn't know which version would be the
one I'm using. I'll read about that (my pages are simple so probably
the one you provide is best anyway).

Yes, I had the code for the clearer but I didn't paste it in the
example... that and the change of order above are exactly what I
needed.

Thanks!!

David


Jonathan N. Little wrote:
> wrote:
> > Hi,
> >
> >> Not a bug, you are not implementing your floats correctly. Put the
> >> right-floated image *before* the regular flow text "Personal Page" in
> >> the markup.
> >>
> >> --
> >> Take care,
> >>
> >> Jonathan
> >> -------------------
> >> LITTLE WORKS STUDIO
> >> http://www.LittleWorksStudio.com

> >
> > Thanks a lot, it works perfectly in IE. On the other hand, in Firefox
> > the extra line is gone but the text+bg does not extend all the way and
> > is not centered (the orange box doesn't include the images). Is that
> > also solvable in a simple way? I'd be more than satisfied if those two
> > browsers can see my page well.

>
> Well David you have a number of errors that is the cause of your
> problems. One of which is your in quirks mode without the doctype and a
> few others.
>
> Why are your making DIV title display inline? Removing that helps. Now
> to get your title DIV to wrap around the floated images your have three
> options I can think of:
>
> 1) Explicitly define the 'height' of 'title'
> 2) Use a clearing element (as you are doing but you are missing the
> definition of your 'clearer' class)
> 3) Make overflow of 'title' DIV auto
>
>
> CODE try it and see:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html><head><title>CSS test</title>
>
> <style type="text/css">
> #main {width: 100%;}
> body {background-color: #999999; margin: 0; padding: 0; }
> #bannerleft {float: left; }
> #bannerright {float: right; }
>
> #title {
> border: 3px coral solid;
> width: 100%;
> color: blue;
> background: #000000 url(arn.gif) repeat-x;
> font-size: 35px;
> text-align: center;
> overflow: auto;
> }
> </style>
>
> </head>
> <body>
>
> <div id="main">
> <div id="title">
> <img src="test_files/b-l.gif" id="bannerleft" height="90" width="60">
> <img src="test_files/b-r.gif" id="bannerright" height="90" width="60">
> Personal Page
>
> </div>
>
> </div>
>
> </body></html>
>
> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIO
> http://www.LittleWorksStudio.com


 
Reply With Quote
 
jojo
Guest
Posts: n/a
 
      07-24-2006
wrote:

> I didn't add a doctype because I didn't know which version would be the
> one I'm using. I'll read about that (my pages are simple so probably
> the one you provide is best anyway).


Depends on how close your code is to specs. There are a few HTML
elements and attributes you aren't allowed to use with HTML 4.1 *STRICT*.
One example is the definition of the "target" attribute in hyperlinks.
This attribute is part of HTML 4.1 TRANSITIONAL, but not allowed in
STRICT, which means you cannot use frames or open links in new
windows/tabs (target="_blank").
So I don't know if TRANSITIONAL or STRICT is better for you - you decide.

BTW: please don't "top-post", write your own text *below* the quote.
This improves the readability of a thread - top to bottom and not the
way round.
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      07-24-2006
jojo wrote:
> wrote:
>
>> I didn't add a doctype because I didn't know which version would be the
>> one I'm using. I'll read about that (my pages are simple so probably
>> the one you provide is best anyway).

>
> Depends on how close your code is to specs. There are a few HTML
> elements and attributes you aren't allowed to use with HTML 4.1 *STRICT*.
> One example is the definition of the "target" attribute in hyperlinks.
> This attribute is part of HTML 4.1 TRANSITIONAL, but not allowed in
> STRICT, which means you cannot use frames or open links in new
> windows/tabs (target="_blank").
> So I don't know if TRANSITIONAL or STRICT is better for you - you decide.


Since this is a new webpage and David is a newbie I thought it best to
steer hit towards *strict*. Learn to do it the right way from the start
and reserved '*transitional* for preexisting sites where resources to
not allow for a full overhaul.


>
> BTW: please don't "top-post", write your own text *below* the quote.
> This improves the readability of a thread - top to bottom and not the
> way round.


Ditto on the top-posting.


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Banner Problem mike Computer Support 5 10-18-2006 10:56 PM
Problem with banner Decadre HTML 5 02-27-2006 10:51 PM
dynamic banner text S.Hoitinga Javascript 8 06-13-2004 03:25 AM
AAA login banner and Cisco VPN client problem lombardi Cisco 3 12-20-2003 01:44 AM
MOD/Banner on Catalyst 3548 twi2ted_pair Cisco 6 10-28-2003 10:06 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57