Google Answers Logo
View Question
 
Q: Replacing HTML TABLE tags, transparent images, image maps with CSS ( No Answer,   1 Comment )
Question  
Subject: Replacing HTML TABLE tags, transparent images, image maps with CSS
Category: Computers > Programming
Asked by: zhong311-ga
List Price: $50.00
Posted: 02 Apr 2005 17:30 PST
Expires: 05 Apr 2005 01:26 PDT
Question ID: 504164
Replacing HTML TABLE tags, transparent images, image maps with CSS

ESPN announced that their website no longer uses HTML hacks and tricks
to achieve stunning formatting. The aforementioned tricks also made
accessibility extremely hard providing further incentive to learning
how to format in CSS. I'm a semi-professional web designer who is
trying to learn how to do the same.

I've already read the http://www.w3.org/ web site on articles on CSS.
But they do not have an example of what I want to do. Actually, they
have nice examples, but not all of them work in IE, FireFox, Opera,
etc in the same way.

I've also read http://www.useit.com/alertbox/9605.html the usability
guidelines. But honestly, my audience want a little flash. One big
point was pages that don't expand to fill the whole screen. Visitors
with big screens want to use it all.

I've also read http://www.alistapart.com/articles/practicalcss/ and
http://glish.com/css/7.asp but can't seem to be able to translate that
into my situation.

As I learn best by example. Please consider this problem.

<BODY>
<FORM>
<DIV style="background-color: red; width: 100%;">
  <DIV id="image01" style="height: 50px; width: 770px;
background-color: green">This DIV tag will really be an image</DIV>
</DIV>
<DIV style="background-color: red; width: 100%:">
  <DIV id="menu" style="background-color: lime; width: 626px;">Menu |
Items | Here | and | More</DIV>
  <INPUT type="text" name="search" value="search"> <INPUT
type="submit" name="go" value="Go!">
</DIV>
</FORM>
My main material
</BODY>

This example viewd in IE will have the text field directly below the
Menu | Items | Here section. I would like it to be exactly right of
the lime div section.

I've tried.

1) changing div id="menu" to span
   But this doesn't allow me to specify the width of the lime green section.

   why is it important?
   Because the div id="image01" will really be an image with to main
colors: left greenish, right reddish. The image has a total width of
770px, starting left going right, at the 626px mark the color changes.
The menu div will be teh same color as the left side of the image, and
the text input will be the same color as the right side of the image;
giving the illusion that the image encompasses the text input and
menu...with out doing image maps or cutting the image and putting in a
table.

2) changing the red div to be relative positioned and the text section
to be absolute positioned. Like so:

<DIV style="position: relative; top: 0px; left: 0px; background-color:
red; width: 100%:">
  <DIV id="menu" style="background-color: lime; width: 626px;">Menu |
Items | Here | and | More</DIV>
  <DIV style="position: absolute; top: 0px; left: 626px;">
  <INPUT type="text" name="search" value="search"> <INPUT
type="submit" name="go" value="Go!">
  </DIV>
</DIV>

But the go button drops down out of the red section if the screen is too small.

3) I've tried setting the width, height style properties of everything
so that it would work. But as i said eariler i want the right red of
the top and bottom div to stretch so the entire top looks like part of
the image and the main body of the screen fills the entire monitor of
those luckly enought to have those hugh monitors.

Answer I would like:
Modify my example so that the text input is directly to the right of
the menu section. Ideally, example should be simple and work on the
majority of platforms. Should it get complicated, plenty of comments
explaining why a particular piece of code is there. Other tips,
suggestions, resources, etc. greatly appreciated.

Thank you

Clarification of Question by zhong311-ga on 04 Apr 2005 01:48 PDT
Thanks willcodeforfood-ga!

Both are amazingly simple solutions. I think I will try the 2nd
solution in my test page first because 1) that red line appears under
the lime section (which actually isn't that hard to fix, I can set the
height to something appropriate) 2) When the browser window is too
small the Go button disappears off the screen (in IE, ok in Firefox,
haven't tested others yet). I think I saw a fix for that on the w3 web
site too.

The 2nd one works "out of the box" in the exact manner I want it too.
I wish there was a way for me to send you food. :)
Answer  
There is no answer at this time.

Comments  
Subject: Re: Replacing HTML TABLE tags, transparent images, image maps with CSS
From: willcodeforfood-ga on 03 Apr 2005 13:16 PDT
 
I found two ways to accomplish what you are trying, but I only
verified they display properly on IE.  Their appearances were not the
same, so I'm including both so you can continue working from the one
that more closely matches your desired layout.

1) Use relative and absolute positioning, with adjustments from the
way you were doing it:

<html>
<BODY>
<FORM>
<DIV style="background-color: red; width: 100%;">
  <DIV id="image01" style="height: 50px; width: 770px;
background-color: green">This DIV tag will really be an image</DIV>
</DIV>
<DIV style="background-color: red; width: 100%:">
  <DIV id="menu" style="background-color: lime; width: 626px;
position:absolute">Menu | Items | Here | and | More</DIV>
  <DIV style="position:relative; left:626px; top:0px">
    <INPUT type="text" name="search" value="search">
    <INPUT type="submit" name="go" value="Go!">
  </DIV
</DIV>
</FORM>
My main material
</BODY>
</html>



2) Stop the wrapping with the <nobr> tag:

<html>
<BODY>
<FORM>
<DIV style="background-color: red; width: 100%;">
  <DIV id="image01" style="height: 50px; width: 770px;
background-color: green">This DIV tag will really be an image</DIV>
</DIV>
<DIV style="position: relative; top: 0px; left: 0px; background-color:
red; width: 100%:">
  <DIV id="menu" style="background-color: lime; width: 626px;">Menu |
Items | Here | and | More</DIV>
  <DIV style="position: absolute; top: 0px; left: 626px;">
    <nobr>
    <INPUT type="text" name="search" value="search">
    <INPUT type="submit" name="go" value="Go!">
    </nobr>
  </DIV>
</DIV>
</FORM>
My main material
</BODY>
</html>

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy