473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to align elements and define resize behaviour?

Hello,

I'm experienced Windows programmer, however, I'm quite
novice in HTML technologies. Recently I was assigned a task
to write small utility for internal use in our development
team. I chose to write its GUI in HTML and make front end as
HTA.

While developing application's logic is no problem the HTML
layout and properties require some additional efforts. So, I
decided to ask my questions here, where almost everybody is
well proficient in HTML and far beyond hypertext markup.
Please, bear with me if my questions seem too dull.

My application is wizard-like and has following layout:

+---+---------+ I - image
| I | iframe | iframe - IFRAME object
| | | [] - buttons
|---+---------|
|[] | [][] []|
+---+---------+

It's regular table with elements inside each cell. Now the
questions:

1. How can I specify that width of I-cell will be
automatically adjusted to the width of image? Currently I
hardcoded WIDTH="N", where N is number of pixels.

2. How can I specify that height of second row (with
buttons) will be equal to the default height of button?

3. During document resize I want that:
a) width of first column (with image) won't change
b) height if second row (with buttons) won't change
c) height and width of iframe-cell can change freely

how can I achieve that? Currently, during resize whole table
changes proportionally.

Thanks in advance
Alex
Oct 24 '05 #1
17 2737
Alex Blekhman wrote:
While developing application's logic is no problem the HTML
layout and properties require some additional efforts.

My application is wizard-like and has following layout:

+---+---------+ I - image
| I | iframe | iframe - IFRAME object
| | | [] - buttons
|---+---------|
|[] | [][] []|
+---+---------+

It's regular table with elements inside each cell. Now the
questions:


Stop using tables for layout. Tables are meant for marking up tabular
data, which this is clearly not.

Look up CSS. There's some good layout techniques available at Position
is Everything, which may be suitable for your needs. Try google for
others, or ask in a CSS related group, like c.i.w.a.stylesheets

http://positioniseverything.net/

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Oct 24 '05 #2
"Alex Blekhman" <tk*********@yahoo.com> wrote:
I'm experienced Windows programmer, however, I'm quite
novice in HTML technologies.
At least you didn't make the usual programmer mistake to call HTML a
programming language, I live in hope that you know that the "ML" in HTML
stands for "Markup Language".
Recently I was assigned a task
to write small utility for internal use in our development
team. I chose to write its GUI in HTML and make front end as
HTA.

While developing application's logic is no problem the HTML
layout and properties require some additional efforts. So, I
decided to ask my questions here, where almost everybody is
well proficient in HTML and far beyond hypertext markup.
Please, bear with me if my questions seem too dull.

My application is wizard-like
It does magic?
and has following layout:

+---+---------+ I - image
| I | iframe | iframe - IFRAME object
| | | [] - buttons
|---+---------|
|[] | [][] []|
+---+---------+

It's regular table with elements inside each cell.
Had it been a web "application" we would have lectured you about
semantics, not using tables for layout etc. Since it's for an intranet
I'm going to assume that this is less relevant.
Now the questions:

1. How can I specify that width of I-cell will be
automatically adjusted to the width of image? Currently I
hardcoded WIDTH="N", where N is number of pixels.
Then don't do that. A table cell's width "shrink wraps" around it's
content. However since you used the magic word "application" I'm going
to assume that you've set this layout table to occupy the full width of
the viewport by specifying width="100%" on the table itself.

To get the table cell containing the image to be as wide as the image,
but no wider, specify a width on the table cell to the right to 100%.
2. How can I specify that height of second row (with
buttons) will be equal to the default height of button?


Don't try to set a height for the row containing the "buttons".

--
Spartanicus
Oct 24 '05 #3
Spartanicus <in*****@invalid.invalid> writes:
"Alex Blekhman" <tk*********@yahoo.com> wrote:

My application is wizard-like


It does magic?


While this statement may sound very wannabe in some ears

<http://catb.org/~esr/jargon/html/W/wizard.html>

the odds ar that in a losedos environment it means little more than
an interface for talking to a paperclip.
+---+---------+ I - image
| I | iframe | iframe - IFRAME object
| | | [] - buttons
|---+---------|
|[] | [][] []|
+---+---------+


Exact table layout algorhythms differ between UAs and you fail to provide
sufficient details. If your Intranet is M$ based and you are using IE
6, ensuring 'quirks mode' and setting the width of the upper left cell
and the height of the bottom cells to '1' or '1%' should suffice.

Otherwise, provide an online test case instead of posting fairly vague
descriptions or snippets of code.
Oct 25 '05 #4
Spartanicus wrote:
At least you didn't make the usual programmer mistake to
call HTML a programming language, I live in hope that you
know that the "ML" in HTML stands for "Markup Language".
I can assure you I know what HTML acronym means. I never
called HTML programming language in my life because
it's...erm...not programming language. I understand the
difference between markup and programming.
My application is wizard-like


It does magic?


I could only hope that by some magic it would do whatever
it's supposed to without intervention of developer at all.
However, since the moment we're expelled from Garden of Eden
cursed are computers and in toil we program them all the
days of our life.

I beg your pardon for assumption that most of readers here
are fluent in Windowese dialects. Here's brief explanation
of wizard.

Wizard is the program, which consists of dialog box. Usually
it has buttons "Back", "Next" and "Cancel". Whan user click
on "Back" or "Next", the content of dialog window changes
and user can select different options. The contents of next
step can depend on choice made by user on previous steps. It
called wizard, because the program like wizard guides user
through configuration/installation/whatever process.

Here's a couple of screenshots of typical wizard interfaces:
http://www.sfsu.edu/~helpdesk/pics/h...te_install.gif
http://is.curtin.edu.au/faqpics/vcitshot1.gif
It's regular table with elements inside each cell.


Had it been a web "application" we would have lectured
you about semantics, not using tables for layout etc.
Since it's for an intranet I'm going to assume that this
is less relevant.


Why shouldn't I use tables for layout? Actually, my first
attempts didn't use tables and when I encountered problems
with alignment and positioning, then fellow web developer
told me to use tables to alleviate this problem. Also, I
noticed that huge amount of web sites use tables for layout.
However, I'll embrace any other solution happily if it'll
provide me with desired result.

My goal is not to impress the public with this application.
Quite the contrary, it should be very basic and should
involve as little technologies as possible, so other HTML
illiterates would be able to support it. This application
won't be on intranet even. It will be launched from disk
directly.

HTA stands for HTML Application in Windows world. It's
regular HTML page [with some HTA specific tags], however
with access rights as executable module. It allows you to
develop simple GUI desktop applications with HTML and
scripts really fast and cheap.
Now the questions:

1. How can I specify that width of I-cell will be
automatically adjusted to the width of image? Currently I
hardcoded WIDTH="N", where N is number of pixels.


Then don't do that. A table cell's width "shrink wraps"
around it's content. However since you used the magic
word "application" I'm going to assume that you've set
this layout table to occupy the full width of the
viewport by specifying width="100%" on the table itself.


Yes, you're right, table's width was 100%.
To get the table cell containing the image to be as wide
as the image, but no wider, specify a width on the table
cell to the right to 100%.


Bingo! This worked.
2. How can I specify that height of second row (with
buttons) will be equal to the default height of button?


Don't try to set a height for the row containing the
"buttons".


Thanks for your help. After little bit of tweaking I
achieved all desired behaviours. Here's final table (with
relevant parts only):

-------
....
<TABLE height="100%" cellspacing="0">
<TR>
<TD valign="top" background="leftBkg.bmp">
<IMG src="left.bmp">
</TD>
<TD width="100%" height="100%">
<IFRAME width="100%" height="100%"></IFRAME>
</TD>
</TR>
<TR>
<TD align="left">[button]</TD>
<TD align="right">[button][button][button]</TD>
</TR>
</TABLE>
....
-------

Thanks
Alex
Oct 25 '05 #5
Eric B. Bednarz wrote:

While this statement may sound very wannabe in some ears

<http://catb.org/~esr/jargon/html/W/wizard.html>

the odds ar that in a losedos environment it means little
more than
an interface for talking to a paperclip.
[...]
Exact table layout algorhythms differ between UAs and you
fail to provide sufficient details. If your Intranet is
M$ based and you are using IE 6, ensuring 'quirks mode'
and setting the width of the upper left cell and the
height of the bottom cells to '1' or '1%' should suffice.

Otherwise, provide an online test case instead of posting
fairly vague descriptions or snippets of code.


You could save your sarcasm for more appropriate occasion.
See my response to Spartanicus where I describe the solution
for my problem.

I'll emphasize again that this is _NOT_ first class web
application. It's simple GUI utility for making
configuration scripts for our internal tasks. There is no
requirements for exact layout of elements. The goal is to
employ as little technologies as possible. Reliance on basic
HTML capabilities is of primary concern.

Thanks
Alex
Oct 25 '05 #6
"Alex Blekhman" <tk*********@yahoo.com> writes:
You could save your sarcasm for more appropriate occasion.
Sigh, you don't give all relevant information, also not in that post
See my response to Spartanicus where I describe the solution
for my problem.


because doctype sniffing happens to matter in this case. The difference
between my suggestion and your solution is that mine works quite
consistently in quite all more or less contemporary UA's and degrades
acceptably if not (read: IE5/Mac and IE6 in 'standards compliance' mode
would calculate the sizes relative to the contents). Yours would cause
a vertical scrollbar in iCab and IE6 in 'standards compliance' mode.

Oct 25 '05 #7
On Tue, 25 Oct 2005, Alex Blekhman wrote:
Eric B. Bednarz wrote: [...snip...]
You could save your sarcasm for more appropriate occasion.
Since you now make it clear, if it wasn't already, that you were
mis-using a WWW group in the interest of designing some internal
system, I'd say you should be only too grateful that you get any kind
of constructive answer.
See my response to Spartanicus where I describe the solution
for my problem.
I come here for discussions about the WWW. If you can learn something
useful from such discussions, then you're very welcome to use them for
your own purposes, but that's not what the WWW groups are for.

As an aside, I've seen quite a number of mistakes where web
applications have been designed for what the designer perceived to be
the specific situation, where the situation has later changed (due to
new browser versions, security issues, random management decisions
etc.) which could have been avoided if the design had been tackled *as
if* it was for the WWW.
I'll emphasize again that this is _NOT_ first class web
application.


bye
Oct 25 '05 #8
Alan J. Flavell wrote:
Since you now make it clear, if it wasn't already, that
you were mis-using a WWW group in the interest of
designing some internal system, I'd say you should be
only too grateful that you get any kind of constructive
answer.
I'm sorry if I insulted you in some way. By no means it was
my intend. However, in my defence I can say that when you
get response, which mentions "losedos environment" and "M$",
then it quickly prompts /. style of discussion.
I come here for discussions about the WWW. If you can
learn something useful from such discussions, then you're
very welcome to use them for your own purposes, but
that's not what the WWW groups are for.
I agree with you that my task is not WWW application in
strict definition of the term. However, IMO, it's very
close. Yes, I'm bound to specific OS and certain browser.
It's highly unlikely that my environment will change in the
future. I don't have cross platform, cross browsers
requirements. Shouldn't it make the task easier? Yes, my
browser loads HTML page from drive instead of HTTP protocol,
but how can it influence HTML rendering? Correct me if I
wrong, but I think that from browser's point of view it's
the same HTML.
As an aside, I've seen quite a number of mistakes where
web applications have been designed for what the designer
perceived to be the specific situation, where the
situation has later changed (due to new browser versions,
security issues, random management decisions etc.) which
could have been avoided if the design had been tackled
*as if* it was for the WWW.


That's why I'm asking my question in the HTML authoring
group. I'm open to any advice or remark made by professional
HTML developer. Currently I'm trying to rephrase my task in
the answer to Eric B. Bernardz' post. If my description of
the problem is lacking some information, then I'm ready to
provide anything whatever you consider important. But tell
me what is it.

Thanks
Alex

Oct 26 '05 #9
Eric B. Bednarz wrote:
Sigh, you don't give all relevant information, also not
in that post
I apologise if my description was unclear. I'll try to
describe it in another way. My goal is to make HTML
document, which consists of four parts:

+---+---+
| 1 | 2 | 1 - image
+---+---+ 2 - iframe
| 3 | 4 | 3 - left aligned button
+---+---+ 4 - three right aligned buttons

This layout should occupy all visible area of the document.
During resize I want that:

- part 1 can change its height, but not width
- part 2 can change both its height and width
- part 3 can change its width, but not height
- part 4 the same as part 3

Also, I need that part 1 will make its width equal to the
width of image. That's all. Regarding possible solution, I
would prefer to stay within basic HTML (if possible) even at
the cost of trading coolness of the look for simplicity.

Currently I can achieve my goal by using table with
following parameters:

<TABLE height="100%">
<TR>
<TD valign="top" background="leftBkg.bmp">
<IMG src="left.bmp">
</TD>
<TD width="100%">
<IFRAME width="100%" height="100%"></IFRAME>
</TD>
</TR>
<TR height="1%">
<TD align="left">[button]</TD>
<TD align="right">[button][button][button]</TD>
</TR>
</TABLE>
because doctype sniffing happens to matter in this case.
The difference between my suggestion and your solution is
that mine works quite consistently in quite all more or
less contemporary UA's and degrades acceptably if not
(read: IE5/Mac and IE6 in 'standards compliance' mode
would calculate the sizes relative to the contents).
Yours would cause a vertical scrollbar in iCab and IE6 in
'standards compliance' mode.


My client is IE5.5/IE6[/IE7?] on Windows for foreseeable
future. Anyway, I'm ready to implement it in most robust way
toprevent headaches right from the beginning.

Thanks
Alex


Oct 26 '05 #10

Eric B. Bednarz wrote:
"Alex Blekhman" <tk*********@yahoo.com> writes:
You could save your sarcasm for more appropriate occasion.


Sigh, you don't give all relevant information, also not in that post
See my response to Spartanicus where I describe the solution
for my problem.


because doctype sniffing happens to matter in this case. The difference
between my suggestion and your solution is that mine works quite
consistently in quite all more or less contemporary UA's and degrades
acceptably if not (read: IE5/Mac and IE6 in 'standards compliance' mode
would calculate the sizes relative to the contents). Yours would cause
a vertical scrollbar in iCab and IE6 in 'standards compliance' mode.


Oct 26 '05 #11
hai,
recently, i saw the getinnet it solution, they give all the solution
about web desinging and programming languages. it is very good. let you
try.

Oct 26 '05 #12
"Alex Blekhman" <tk*********@yahoo.com> writes:
I apologise if my description was unclear.
It was rather incomplete, but let's cut this short.

Click here to start:

<http://bednarz.nl/swamp/wizard/>

It is possible that the shortage of a doctype declaration causes
problems in Safari, and maybe even IE/Mac, I frankly cannot remember and
I'm too lazy to reboot and check that (and don't be so touchy, you
haven't heard me bitching about OS X yes :).

You can stick one on top as long as you keep care to trigger M$IE's
forwardscompatible mode, meaning either precede it with a comment
declaration or use HTML 4.01 transitional without system identifier.
<TD width="100%">


As I said, that's no good; preferably take the opposite approach, by
limiting the left and bottom elements and letting them expand as
necessary.

Oct 26 '05 #13
Eric B. Bednarz wrote:
Click here to start:

<http://bednarz.nl/swamp/wizard/>


Thanks, this is good starting point.
<TD width="100%">


As I said, that's no good; preferably take the opposite
approach, by limiting the left and bottom elements and
letting them expand as necessary.


Yes, I understand that probably it relies on browser to be
smart too much. I'll try the other approach as well.

As a side question. Is there fundamental difference between
setting element's property via its attribute vs its style?
For example, instead of

<table height="100%">

to do

<style type="text/css">
table { width: 100%; }
</style>

<table>...

Oct 27 '05 #14
"Alex Blekhman" <tk*********@yahoo.com> writes:
As a side question. Is there fundamental difference between
setting element's property via its attribute vs its style?


The first fundamental difference would be that you'd normally keep your
style sheet external (I should probably lose that habit of placing it
internal in *examples*) and change the appearance of all pages in one
place.

Secondly, there is no HEIGHT attribute for the TABLE element type in W3C
HTML; while most UA's have legacy support for it, this may also depend
on doctype sniffing and might be dropped one day altogether.

What's more, since you normally need a parent height of 100% as well
(again, depending on UA's and doctype sniffing, you might get away with
a HEIGHT for TABLE alone, but that's no sensible ground to work on these
days) CSS is a requirement either way.
Oct 27 '05 #15
Thanks for explanation.
Oct 27 '05 #16
Alex Blekhman a écrit :
Eric B. Bednarz wrote:
Sigh, you don't give all relevant information, also not
in that post

I apologise if my description was unclear. I'll try to
describe it in another way. My goal is to make HTML
document, which consists of four parts:

+---+---+
| 1 | 2 | 1 - image
+---+---+ 2 - iframe
| 3 | 4 | 3 - left aligned button
+---+---+ 4 - three right aligned buttons

This layout should occupy all visible area of the document.
During resize I want that:

- part 1 can change its height, but not width
- part 2 can change both its height and width
- part 3 can change its width, but not height
- part 4 the same as part 3

Also, I need that part 1 will make its width equal to the
width of image. That's all. Regarding possible solution, I
would prefer to stay within basic HTML (if possible) even at
the cost of trading coolness of the look for simplicity.

Currently I can achieve my goal by using table with
following parameters:

<TABLE height="100%">
<TR>
<TD valign="top" background="leftBkg.bmp">
<IMG src="left.bmp">
</TD>
<TD width="100%">
<IFRAME width="100%" height="100%"></IFRAME>
</TD>
</TR>
<TR height="1%">
<TD align="left">[button]</TD>
<TD align="right">[button][button][button]</TD>
</TR>
</TABLE>
because doctype sniffing happens to matter in this case.
The difference between my suggestion and your solution is
that mine works quite consistently in quite all more or
less contemporary UA's and degrades acceptably if not
(read: IE5/Mac and IE6 in 'standards compliance' mode
would calculate the sizes relative to the contents).
Yours would cause a vertical scrollbar in iCab and IE6 in
'standards compliance' mode.

My client is IE5.5/IE6[/IE7?] on Windows for foreseeable
future. Anyway, I'm ready to implement it in most robust way
toprevent headaches right from the beginning.


Then use strict DTD, use CSS and drop table-based design for layout.

Gérard
--
remove blah to email me
Oct 27 '05 #17
Gérard Talbot <ne***********@gtalbot.org> writes:
Alex Blekhman a écrit :

My client is IE5.5/IE6[/IE7?] on Windows for foreseeable
future. Anyway, I'm ready to implement it in most robust way
toprevent headaches right from the beginning.


Then use strict DTD, use CSS and drop table-based design for layout.


As much as the OP might have trouble to articulate his situation, we
are facing a total score of three out of three here failing to meet
'robust' in the context of an application interface, be it intra-,
extra- or internet.

Unsurprisingly, details are available at
<http://www.cs.tut.fi/~jkorpela/usenet/laws.html#law22>
--
hexadecimal EBB
decimal 3771
octal 7273
binary 111010111011
Oct 28 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS....
10
by: Markus Ernst | last post by:
Hi I have a strange problem with vertical-align. The case can be viewed at http://www.brainput.info/geschichte.html. HTML code: <div id="bild"><img src="geschichte.gif" width="274"...
6
by: TJ | last post by:
I've got a calendar that is based on the concept of lots of blocks that are spans with float:left. I would like to be able to have a detail section on the right side of the screen, so that when...
6
by: Viken Karaguesian | last post by:
Hello, Just wondering what the difference is between "float" and "align"? If I align a picture to the left, is that not the same as floating it? Can align and float be used together or do you...
34
by: Dennis | last post by:
I would like to dynamically allocate in a sub a 2 dimensional Array float *myarray = new float ; of course I get an error. How do you allocate a 2D array using the New operator? I...
2
by: Alex Blekhman | last post by:
Hello, I'm experienced Windows programmer, however, I'm quite novice in HTML technologies. Recently I was assigned a task to write small utility for internal use in our development team. I...
3
by: torbs | last post by:
Strange behaviour in ie7. A collegue of mine put several images into a page using JCE in Joomla. JCE have the option to align these images and he left aligned every single one - to create a...
28
by: v4vijayakumar | last post by:
#include <string> #include <iostream> using namespace std; int main() { string str; str.resize(5); str = 't';
13
by: Roderik | last post by:
Hi, I am wondering why (half of the) squared images are not aligned on the right of the text in Internet Explorer (using <img ... align="right" />. I thought this was supported even in IE. In FF...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.