Is there a way to create a CSS div that adjusts its width based on the text it contains? I attempted
div.reqspace {
float : left;
width : 10px;
}
but realized that there is no 'length' attribute. As a result, my div now spans almost the full width of the screen.
<?php include("sitestartend.php");
site_start('xyz);?>
<?php include("helpfun.php");
$addr = getRealIpAddr();
if ($addr != '$myaddr') {
echo '<p>Sivusto on kehitteillä.</p></body></html>';
die();
}
include("navbar.php"); ?>
navbar loaded!
<div id="reqspace">
Email address: <br/>
Choose your password: <br/>
</div>
<input type="text" name="email" value="" />
<input type="text" name="email" value="" />
<input type="password" name="password" value="" />
<input type="submit"/>
</body>
</html>
sitestartend.php
<?php
function site_start($name) {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
echo '<head>';
echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>';
echo ' <title>'.$name.'</title>';
echo ' <link type="text/css" rel="stylesheet" href="styles.css" />';
echo '</head>';
echo '<body>';
}
function site_end() {
echo '</body>\n</html>';
}
helpfun.php
<?php
function getRealIpAddr() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
?>