The button is always "at the right of the containing div" but the
input field can't "stretch[] over the available space" because you
have pinned down a definite px width. How can it stretch?
> What can I do?
>
OK, let's look at your particular markup and styling closer.
Why the width on the containing DIV? It is not being floated or
positioned and therefore will be as wide as it's container, possibly
BODY. So, let's cut this width out for a start.
Next, we need to be rid of the margin-right on the input element, it
seems to cause nothing but trouble, no?
Can't see your need for the clearing DIV. But maybe your real
situation is more complex and does need it?
Anyway, this might do you:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Rounded corners</title>
</head>
<body>
<div style="background:red;padding:5px;">
<button type="button" style="float:right;width:
10%;">></button> <input type="text" style="width: 80%;
background-color: yellow;">
</div>
</body>
</html>
This approach helps avoid some pesky issues of float drop that you are
likely not to be wanting to wrestle with.
You could use a table, I would. A table is not just for eating on or
for dramatic effects in films where feverish couples sweep all from
the top before indulging in wild and impulsive gyrations which I
understand you earthlings call sex.
An HTML table is good for your purpose because not only is it
naturally nice for your styling aims but aptly expresses a deeper and
more meaningful connection between the objects in the cells, the
button is the button for the input field, the input field is
incomplete without it and cries for a button.
Come to think of it, this is about as meaningful, sexy and romantic as
HTML can get. I mean, just look at the coldness in your markup. These
two related things are like total strangers, they just happen to be in
the same DIV; that is simply *not* the reality. The table "gets" their
relatedness better. I know this because I write romantic HTML/CSS
novels as a sideline.
> Thank you!
>
> Magnus
--
dorayme