I play with flexible layouts and shapes. I am satisfied with what I still have: it works great from mobile to wide screen; See below. (Only tested on firefox / chrome so far.)
With a width of 800 pixels, it moves the message block to the right column. The problem is that this is done using float: right and position: absolute, which means that its height ceases to affect the surrounding div. Thus, the message box sticks out.
I can (and do) improve this by adding height: 220px so that it looks fine by default. But someone can resize the text box outside the surrounding div. I find resizing text fields a wonderful feature, so I don't want to reject resizing. And overflow: auto is not a solution: the user will just swap the scroll bars for a text box for scroll bars for a div!
So, is there a way to have the outer size of the div to always contain a text box?
<html>
<head>
<style>
body{background:#fff;font-family:FreeSerif, serif;font-size:16px;margin: 0 0 0 0;}
#contactform {margin: 0 auto;width:90%;max-width:320px;border:1px #000 solid;border-radius:8px;padding:6px;}
#contactform .required:after{color:red;content:" *";}
#contactform label {display:block;}
#contactform textarea {height:120px;rows:5;min-width:90%;max-width:90%;}
#contactform input,textarea {border: 1px solid red;border-radius:8px;width:90%;height:26px;padding:2px 4px;font-family:sans;}
@media (min-width: 800px) {
#contactform {margin: 0 auto;width:640px;max-width:640px;position:relative;}
#formsecondhalf {top:0;right:6px;position:absolute;}
#contactform textarea {height:200px;rows:8;min-height:200px;min-width:300px;max-width:300px;}
#contactform input,textarea {width: 300px;min-width:300px;max-width:300px;}
}
</style>
</head>
<body>
<div id="contactform">
<form action="" method="post">
<label for="name" class="required">Name:</label>
<input id="name">
<br/>
<label for="email" class="required">Email:</label>
<input id="email">
<br/>
<div id="formsecondhalf">
<label for="message">Message:</label>
<textarea id="message"></textarea>
</div>
<br />
<input type="submit" value="SEND">
</form>
</div>
</body>
</html>
source
share