473,387 Members | 1,532 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,387 software developers and data experts.

styling a submit button as regular text link

Hello,
I'd like to style a submit button as regular text link.
demo: www.byteshift.de/msg/div/input-as-link-by-css (XHTML strict)

I applied "display:inline; margin:0; padding:0;" to both the form and
the
input and "background:none; border:none;" to the input only,
which should do the trick, but it doesn't.

Gecko (using Firefox1.0/Win) keeps adding space to the left and right.
MSIE6 adds space to the left, right and top.

I know how to deal with this using JS, but I'm looking for a CSS
solution.

I tried solutions based on setting explicit width, height,
position:absolute/relative or negative margin/padding, they break when
fontsizes are changed by css or overridden by the user - which he can
do in
eg. safari/gecko/khtml.

Besides, they'd break when the content changes, so it would be hard to
mantain.
Any advice?
Marek
BTW:
I cant't post to dp-news.maxwell.syr.edu using a mail client, I keep
getting "440 Posting Not Allowed".

I don't know if it's needed, but I applied for and got a LISTSERV
password using bn**@gmx.net, but when trying to login to
"listserv.uga.edu/cgi-bin/wa?P1&L=sas-l" I keep getting "...you are not
authorized to post to the SAS-L list from the address you entered in
the login screen". What can I do?

Jul 21 '05 #1
10 17154
bn**@gmx.net wrote:
Hello,
I'd like to style a submit button as regular text link.
demo: www.byteshift.de/msg/div/input-as-link-by-css (XHTML strict)

I applied "display:inline; margin:0; padding:0;" to both the form and
the
input and "background:none; border:none;" to the input only,
which should do the trick, but it doesn't.

Gecko (using Firefox1.0/Win) keeps adding space to the left and right.
MSIE6 adds space to the left, right and top.

I know how to deal with this using JS, but I'm looking for a CSS
solution.

I tried solutions based on setting explicit width, height,
position:absolute/relative or negative margin/padding, they break when
fontsizes are changed by css or overridden by the user - which he can
do in
eg. safari/gecko/khtml.

Besides, they'd break when the content changes, so it would be hard to
mantain.
Any advice?
Marek
BTW:
I cant't post to dp-news.maxwell.syr.edu using a mail client, I keep
getting "440 Posting Not Allowed".

I don't know if it's needed, but I applied for and got a LISTSERV
password using bn**@gmx.net, but when trying to login to
"listserv.uga.edu/cgi-bin/wa?P1&L=sas-l" I keep getting "...you are not
authorized to post to the SAS-L list from the address you entered in
the login screen". What can I do?

If you muck around with styles long enough you will discover what to
do. Can you provide a sensible reason for hiding a submit button?
--
Fred
Jul 21 '05 #2
bn**@gmx.net wrote:
Hello,
I'd like to style a submit button as regular text link.
demo: www.byteshift.de/msg/div/input-as-link-by-css (XHTML strict)

[snip]

Gecko (using Firefox1.0/Win) keeps adding space to the left and right. MSIE6 adds space to the left, right and top.
I tried solutions based on setting explicit width, height,
position:absolute/relative or negative margin/padding, they break when fontsizes are changed by css or overridden by the user - which he can
do in eg. safari/gecko/khtml.


What you *could* do is study this effect in various browsers, working
out how exactly it depends on font size in each of them, and then use
the various CSS parsing bugs to give each browser different CSS...

The problem is that buttons are not designed to look like links -
buttons are intended to perform some action (like submitting a form),
whereas links just go somewhere (and don't do anything on the way).

--
Safalra (Stephen Morley)
http://www.safalra.com/hypertext/

Jul 21 '05 #3
> If you muck around with styles long enough you will discover what to
do.
Obviously, you didn't get the point ...I already DID muck around and
explained how:
I tried solutions based on setting explicit width, height,
position:absolute/relative or negative margin/padding...
BUT: ...they break when fontsizes are changed... or ...when the content

changes...
Can you provide a sensible reason for hiding a submit button?

When using PHP sessions, links transfer sessions-IDs by long query
strings only, this misleads search engines more often than not to
unwanted and unpredictable indexing results, as some begin to interpret
query strings, but not yet sensibly so. Besides URLs several times as
long than needed are contrary to the concept of providing the visitor
with short URLs that can remembered and typed easily. Using mod_perl to
preserve states would help in some situations, but I can't tell my
clients to switch server/provider whenever it suits me. So, in some
situations, it's advisable to transfer states by POST and not by GET.
Stuffing text blocks with form elements is unsightly, though.

Jul 21 '05 #4
> What you *could* do is study this effect in various browsers, working
out how exactly it depends on font size in each of them, and then use Thx, I know, but I don't want to: it would be hardly manageable. I'm
looking for a generic CSS solution. Should there be none, I'll resort
to JS, but that's second choice.
the various CSS parsing bugs to give each browser different CSS...

Indeed bugs they are, as setting margin, padding, border, bg and
display as I did should do, according W3C.

Jul 21 '05 #5
Marek Moehling wrote:
Can you provide a sensible reason for hiding a submit button?
When using PHP sessions, links transfer sessions-IDs by long query
strings only, this misleads search engines more often than not to

This is untrue. PHP can access data sent by both GET and POST methods.
[...] Using mod_perl to
preserve states would help in some situations, but I can't tell my
clients to switch server/provider whenever it suits me. So, in some
situations, it's advisable to transfer states by POST and not by GET.
Stuffing text blocks with form elements is unsightly, though.

Using the POST method and hidden input fields eliminates URL bloat.
Since your are using php, this should be no problem delivering pages with
tracking data.
Why mod_perl? You have php.
I do not understand you comment about switching ISPs.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 21 '05 #6
On Tue, 12 Apr 2005, Jim Moe wrote:
Using the POST method and hidden input fields eliminates URL bloat.


Off-topic for a stylesheets group; but unnecessary use of POST can
also make a site more hostile to navigate. Attempts to move Back can
result in browser alerts, warning about re-submission of POST data.
And things that would have been naturally cacheable become by default
uncacheable, and have to be delivered all over again by the server,
unless the author has the expertise to deal with such details.

Oh, and trying to fake a submit control as a text link is rude. Users
get to know what the various components of a web page look like, and
how they're likely to behave; the more discerning ones will get angry
if they find you're fooling them. (Or maybe the hon Usenaut doesn't
want any discerning visitors? SCNR).
Jul 21 '05 #7
Sorry - mostly OT, still looking for answers to my CCS issue, though...

When using PHP sessions, links transfer sessions-IDs by long query
strings only, this misleads search engines more often than not to This is untrue. PHP can access data sent by both GET and POST...

I've said nothing to the contrary: My issue here are links, THEY are
restricted to GET - and that's what I'd like to get around "...IN SOME
SITUATIONS..." only, though...
Using the POST method and hidden input fields eliminates URL bloat. Thx, that's resuming my explanation, ...detailed for those who might
need it.
Since your are using php, this should be no problem delivering pages
with tracking data. It is (visually, not technically) WHEN trying do do it insides of text
blocks:
...Stuffing text blocks with form elements is unsightly, though... Why mod_perl? You have php.
I do not understand you comment about switching ISPs.

Unlike PHP, mod_perl can preserve states even when using links and
without query strings, so in some situations I'd prefer mod_perl over
PHP, but when my clients' account doesn't offer this option, switching
to an hoster that does is the only solution ...which often is not
viable neither, as clients tend not to want the buerocratic hassle
involved or possible extra charges.

As for Jim Moe's reply:
Off-topic for a stylesheets group; but unnecessary use of POST can
also make a site more hostile to navigate. Attempts to move Back can
result in browser alerts, warning about re-submission of POST data. And things that would have been naturally cacheable become by default uncacheable, and have to be delivered all over again by the server,
unless the author has the expertise to deal with such details. Well known and very, very true.
Oh, and trying to fake a submit control as a text link is rude. Users get to know what the various components of a web page look like, and
how they're likely to behave; the more discerning ones will get angry if they find you're fooling them. (Or maybe the hon Usenaut doesn't
want any discerning visitors? SCNR).

So flame wars began; the above is well known and SO true again and yet
it starts to get obsessive-compulsive here, "...IN SOME SITUATIONS it's
advisable to transfer states by POST and not by GET" is my stand,
nothing more or less, wether you mislead users depends on your
intentions and the implementation. You CAN mislead users even when
adhering slavishly to standards.
Resuming: Browsers have bugs rendering form elements, they add
padding/margin/whatever where (according W3C specs) they shouldn't.
That's well known and mostly doesn't become visible, though sometimes
it does. So far nobody found an answer to my **CSS** issue, which is
quite OK: neither did I - but I'd prefer those who have no solutions
but strong OT stands (or prefer to read selectively) just not to post.
Should a good idea come up, I'd still be glad to hear about it.

Jul 21 '05 #8
Marek Moehling <bn**@gmx.net> wrote:
So far nobody found an answer to my **CSS** issue, which is
quite OK: neither did I - but I'd prefer those who have no solutions
but strong OT stands (or prefer to read selectively) just not to post.
Should a good idea come up, I'd still be glad to hear about it.


Welcome to USENET. It's a discussion forum. You posted a message, and
various people have discussed it. You don't get to control which aspects of
your original message are open for discussion and which aren't.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"I can take one day at a time, but sometimes several days attack me at once."
Jul 21 '05 #9
Marek Moehling wrote:
If you muck around with styles long enough you will discover what to
do.

Obviously, you didn't get the point ...I already DID muck around and
explained how:
I tried solutions based on setting explicit width, height,
position:absolute/relative or negative margin/padding...

BUT:
...they break when fontsizes are changed... or ...when the content


changes...

Can you provide a sensible reason for hiding a submit button?


When using PHP sessions, links transfer sessions-IDs by long query
strings only, this misleads search engines more often than not to
unwanted and unpredictable indexing results, as some begin to interpret
query strings, but not yet sensibly so. Besides URLs several times as
long than needed are contrary to the concept of providing the visitor
with short URLs that can remembered and typed easily. Using mod_perl to
preserve states would help in some situations, but I can't tell my
clients to switch server/provider whenever it suits me. So, in some
situations, it's advisable to transfer states by POST and not by GET.
Stuffing text blocks with form elements is unsightly, though.


Interesting discussion below.

Here is my effort. Only tested in Firefox & IE, so you may want to
try a few other mainstream ones - Netscape, Safari, Opera maybe.

Only included the relevant bits:
<style type="text/css">
body { margin:10px; vertical-align: middle;}
* { font:normal 20px/25px courier, monospace;}

.linkForm, .link
{ display:inline; margin:0; padding:0; vertical-align: -1px;
width: 3.8em;}
.link
{ background:none; border:none; cursor:pointer; color:red;
text-align: left; line-height: 1;}
.sSpace {font-size: 85%;}
</style></head>

<body>

<div id="summary">
someStr anotherStr BUTTON yetAnotherStr<br>
someStr anotherStr BUTTON yetAnotherStr<br>
<form class="linkForm">someStr anotherStr<span
class="sSpace">&nbsp;</span><input type="submit" class="link"
value="BUTTON"><span
class="sSpace">&nbsp;</span>yetAnotherStr</form><br>
someStr anotherStr BUTTON yetAnotherStr<br>
someStr anotherStr BUTTON yetAnotherStr<br>
</div>
--
Fred
Jul 21 '05 #10
Thx, that's quite an improvement, some pixel quirks remain. I'll work
with that, possibly trying to get rid of the spans. I won't have time
soon though, anyone interested should mail me, I'll alert them when I
post the results.
Marek

Jul 21 '05 #11

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

Similar topics

2
by: Richard B. | last post by:
Hi, Currently designing/building my first class/template driven site. Inside a PHP form a list of article titles are displayed along with the first two lines of the article. When the user...
3
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form...
3
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button...
1
by: Stanimir Stamenkov | last post by:
Here's an example: <form action="bogus" method="post"> <p> <a href="prev.cgi"><input type="submit" name="prev" value="< Back"></a> <a href="next.cgi"><input type="submit" name="next"...
7
by: bill | last post by:
Is there any way to make a link (as marked by an <A>-tag, that is), behave exactly like a submit button? Many thanks! -bill
1
by: Kwart246 | last post by:
Hello, Is it possible to use a text link to enable a radio button, just like some windows interfaces, when the text is clicked, the radio button gets selected..... This works for a checkbox:...
5
by: Codeman II | last post by:
Hi there, I am building a form where the user must upload a picture and fill in his details. Now I have a problem as all of this is on the same form. How will I be able to have the Browse...
3
by: kavithadevan | last post by:
Hi, Here i have pasted 2 scripts first one is design and next one is country.php in the below code is working nicely. ----------------------design.php------ <form name="form1" method="post"...
2
by: Sapera | last post by:
I want to create an text field then a submit button. The text field is supposed to be the answer of a question. If the user types the correct answer and clicks submit, he is taken to the next...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.