473,569 Members | 3,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: "simple" buttons - possible without tables?


Hmmm... anyone? :)

Anze
Anze wrote:
Hi!

I am looking for a cleaner solution that would display sth. like this, but
I simply ran out of ideas:
-----
<table border="0" cellpadding="0" cellspacing="0" style="border: 1px solid
#d4d4d4;">
<tr>
<td style="padding: 1px; background-color: #ffffff;">
<input type="submit" value="test 123" style="height: 18px;
background: #e9eaea url(gradient.gi f) left top repeat-x; width: auto;
border: none; padding: 0px 10px;" />
</td>
</tr>
</table>
-----

(I have attached an image - a button of height 18px and auto width that
has a white border of 1px and around it a dark-gray border of 1px. The
background of the button must be a gradient image)

I have tried this:
-----
<div class="button">
<input type="submit" class="button" value="test 123" />
</div>
-----
CSS:
-----
div.button {
display: inline;
border: 1px solid #d4d4d4;
background-color: #ffffff;
padding: 1px;
}
input.button {
background: #e9eaea url(gradient.gi f) left top repeat-x;
padding: 0px;
margin: 0px 10px;
border: none;
height: 18px;
line-height: 18px;
}
-----

If div.button is display:block; then I can't set width to auto. On the
other hand if it is inline I can't specify height.

Of course, I am looking for cross-browser no-hacks solution. Otherwise I'd
rather resort to tables. ;)

Is this possible?

I would appreciate some help.

Thanks,

Anze
Oct 7 '08 #1
10 1752
Anze wrote:
Hmmm... anyone? :)
No. When you posted an attachment to Usenet, you excluded constructive
discussion - especially since you failed to provide a URL. Well, an absolute
URL, that is.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Oct 7 '08 #2
>Hmmm... anyone? :)
>
No. When you posted an attachment to Usenet, you excluded constructive
discussion - especially since you failed to provide a URL. Well, an
absolute URL, that is.
Sorry, I thought the mail was clear enough and the image was just an added
bonus.

Here is the URL:
http://users.volja.net/anzesk/usenet/test.html

I would still appreciate any thoughts on this. I can find many workarounds
but not... The Right Way (tm). :)

Thanks,

Anze

Oct 7 '08 #3
On Wed, 08 Oct 2008 00:05:48 +0200, Anze <an******@volja .netwrote:
>>Hmmm... anyone? :)

No. When you posted an attachment to Usenet, you excluded constructive
discussion - especially since you failed to provide a URL. Well, an
absolute URL, that is.

Sorry, I thought the mail was clear enough and the image was just an added
bonus.
Not on usenet non-binary groups.
>
Here is the URL:
http://users.volja.net/anzesk/usenet/test.html

I would still appreciate any thoughts on this. I can find many workarounds
but not... The Right Way (tm). :)
I think it may be a case of not trying so hard to control the layout
when you stop using tables, and accept the compromise. Also check
how other major browsers are rendering the markup.

I was tempted to use table layout for a couple buttons here:
http://bugsplatter.id.au/cc2ip/

But didn't -- the form works, it renders cross-browser (I don't really
care about msie-6, not my target audience).

Grant.
--
http://bugsplatter.id.au/
Oct 7 '08 #4

First of all, thank you for the answer! I appreciate it!
>>Sorry, I thought the mail was clear enough and the image was just an added
bonus.
Not on usenet non-binary groups.
Thank you for clearing this up. I'll behave in the future. :)
I think it may be a case of not trying so hard to control the layout
when you stop using tables, and accept the compromise. Also check
how other major browsers are rendering the markup.
This is out of my hands - designer draws, I implement. :)

Seriously, I never meant to use tables - I just wanted to show what I wanted
done. If all else fails I will use a few CSS classes with fixed widths, but
it would be nicer if I didn't have to.

It just seems so limiting that there is no some way to tell a div to shrink
as much as it can.

Thanks,

Anze
Oct 7 '08 #5
In article <v0************ *******@news.si ol.net>,
Anze <an******@volja .netwrote:
It just seems so limiting that there is no some way to tell a div to shrink
as much as it can.
Floating a div does this.

--
dorayme
Oct 7 '08 #6
>It just seems so limiting that there is no some way to tell a div to
>shrink as much as it can.
Floating a div does this.
It does indeed! :) Thank you!

My idea was to use "display: table;", but that doesn't work in IE.

The only remaining problem is padding in Opera, but I can solve that by
using spaces.

Also, IE doesn't allow to eliminate space left and right from text - setting
padding to 0 still shows some space left.

I'll go read about CSS float now... :)

Thank you again!

Anze
Oct 7 '08 #7
Also, IE doesn't allow to eliminate space left and right from text -
setting padding to 0 still shows some space left.
I have solved this by setting overflow to visible:
http://www.brandnewbox.co.uk/article...om_ie_buttons/

The site is updated with all the history, and the last result looks ok in
all the browsers I can get my hands on:
http://users.volja.net/anzesk/usenet/test.html

Thank you again!

Anze

Oct 8 '08 #8

For completeness:
http://css.maxdesign.com.au/floatuto...troduction.htm

Quote:
-----
Do floated items need a width?
You should always set a width on floated items (except if applied directly
to an image - which has implicit width). W3C's Cascading Style Sheets,
level 2, CSS2 Specifications states:
"A floated box must have an explicit width..."
http://www.w3.org/TR/CSS2/visuren.html#floats
If no width is set, the results can be unpredictable. Theoretically, a
floated element with an undefined width should shrink to the widest element
within it. This could be a word, a sentence or even a single character -
and results can vary from browser to browser.
-----

It looks like all major browsers shrink float elements to the widest element
within, but there is no guarantee. W3C certainly doesn't specify it.

By the way: what is the "proper" way to deal with the page that was used for
this question? I will leave it there for the time being, but sooner or
later I'll have to remove it. That's why I originally wanted to post
everything here...

Best,

Anze
Oct 8 '08 #9
On 2008-10-08, Anze <an******@volja .netwrote:
>
For completeness:
http://css.maxdesign.com.au/floatuto...troduction.htm

Quote:
-----
Do floated items need a width?
You should always set a width on floated items (except if applied directly
to an image - which has implicit width). W3C's Cascading Style Sheets,
level 2, CSS2 Specifications states:
"A floated box must have an explicit width..."
http://www.w3.org/TR/CSS2/visuren.html#floats
If no width is set, the results can be unpredictable. Theoretically, a
floated element with an undefined width should shrink to the widest element
within it. This could be a word, a sentence or even a single character -
and results can vary from browser to browser.
-----

It looks like all major browsers shrink float elements to the widest element
within, but there is no guarantee. W3C certainly doesn't specify it.
They do specify it in CSS 2.1. You're looking at CSS 2. The recent
generation of browsers (Firefox, Opera, WebKit) are all aiming for CSS
2.1 plus bits of CSS 3 where they feel like it.

Floats get shrink-to-fit width which is clear most of the time, although
the spec does say it doesn't "define the exact algorithm".

I have seem some differences between browsers in cases where the auto
width float contains both a left and a right float or when it contains
pre-formatted text.

10.3.5:

If 'width' is computed as 'auto', the used value is the
"shrink-to-fit" width. Calculation of the shrink-to-fit width is
similar to calculating the width of a table cell using the automatic
table layout algorithm. Roughly: calculate the preferred width by
formatting the content without breaking lines other than where
explicit line breaks occur, and also calculate the preferred minimum
width, e.g., by trying all possible line breaks. CSS 2.1 does not
define the exact algorithm. Thirdly, find the available width: in
this case, this is the width of the containing block minus the used
values of 'margin-left', 'border-left-width', 'padding-left',
'padding-right', 'border-right-width', 'margin-right', and the
widths of any relevant scroll bars. Then the shrink-to-fit width is:
min(max(preferr ed minimum width, available width), preferred width).
Oct 8 '08 #10

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

Similar topics

1
1692
by: Dario de Judicibus | last post by:
I wish to create two simple layouts by using only HTML, CSS and the minimum JavaScript as possible. Layouts should be "elastic" (no fixed widths and heights) and cross-browser enabled. The first one is a non-scrollable page which contains a centered title and a centered division with automatic scrolling on overflow, that is: ...
1
264
by: Ray Watson | last post by:
Hi all I thought there might be an easy way to have a separate label or picture on web page change as the cursor passes over different buttons on the same web form. In access I could use the "on mouse move" event, but the buttons on web forms don't seem to have that event. Any hints at the process would be greatly appreciated. Cheers
1
2749
by: Richard | last post by:
http://dynamicdrive.com/dynamicindex1/switchmenu.htm I want to add a second level menu item to the existing design. Currently only one level is possible. Item 1 ......link ......link item 2 item 3
2
2057
by: mantas44 | last post by:
Hello all, I have two tables tab_a id(int) tab_b id(int)
19
2489
by: Kramer | last post by:
Hi all, And thank you all so very much for all your recommendations. This is a great group. I ran across a freeware uploader from Toma Web called, Simple FTP 2.0. Anyone have any knowledge about this one. Bill
2
1656
by: Axel Dahmen | last post by:
Hi, I'd like to write a simple COM Automation Server in C# but couldn't find a matching project. I want to have the IDE maintain the IDL and the REG file automatically. Which project should I use to achieve this? TIA, Axel
8
3681
by: Beam_Us_Up_Scotty | last post by:
Hello all, I am trying to write a "simple" animation using C#, and I've tried many things but nothing seems to work for me without leaking memory. Here's a very simple piece of code that uses a timer to set the image of a label from an ImageList every 100ms or so. This is what was being used when I inherited this piece of code, and I...
3
3320
by: BKDotCom | last post by:
This has surely been answered somewhere multiple times, but... I'm guessing it's some sort of "bubbling" thing.... <STYLE> ..triggerarea { border:#00C solid 1px; } </STYLE> <UL ID="menu">
5
16700
by: Mark Chambers | last post by:
Hi there, Can anyone explain the following (very) simple scenario. 1) I make an exact copy of my "DataSet" and delete one record from a given table (in the copy) 2) I invoke "DataSet.GetChanges()" on the above copy and pass the results to "DataSet.Merge()" on the original copy 3) If I now inspect the original copy, it shows that the...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.