Jump to content

Can anyone help me getting started with this div css?


simpli

Recommended Posts

Hi,

I was a bit wary of starting with divs. Seems there's a debate between tables and divs out there. I started with tables now I wanna move to divs. I have this CSS that doesn't work. I would like the width of the div to fit just the text i have inside it but the below code give me a huge width and no matter to which value i put the width I have the same. I just want a rectangle around my text that I can at the desired offset coordinates on the screen. Can anyone troubleshoot that CSS and tell me what's wrong?

 

Thank you

<style type="text/css">
div_1
{
position:relative;
style="width: 200px; height: 50px";
left:10em;
top:10em
}
</style>


<html>
    <head><title>Le pool Des finances!</title></head>

    <body>
<div_1>
<fieldset>
<form method="POST" action="stuff.php">
	<font face="Helvetica" color="#000000" size="4"><b> Nom d'utilisateur </b></font><br>

	<input type="text" name="username" value=""><br><br>
	<font face="Helvetica" color="#000000" size="4"><b> Mot de Passe </b></font><br>
	<input type="password" name="password"><br><br><input type="submit" name="submit" value="submit"></form>  <a href="signup.php">Creer un compte</a>  
  </fieldset>
  </div_1>
</body>
</html> 

There are some very good tutorials out there, try http://www.alsacreations.com/apprendre/ (they have changed their site, but have a look anyway, also try http://css.maxdesign.com.au/floatutorial/tutorial0301.htm hope this helps because looking at your css, well it is written incorrectly. Try also w3schools

There are some very good tutorials out there, try http://www.alsacreations.com/apprendre/ (they have changed their site, but have a look anyway, also try http://css.maxdesign.com.au/floatutorial/tutorial0301.htm hope this helps because looking at your css, well it is written incorrectly. Try also w3schools

 

I second this this as your CSS is 100% bad.

You don't call your custom DIV element by name - give it an ID and your CSS must be between <head> and </head>.

 

<html>
<head>
  <title>Le pool Des finances!</title>
  <style type="text/css">
    #div_1 {
      width: 200px;
      height: 50px;
    }
  </style>
</head>
<body>
<div id="div_1">
<fieldset>
   <form method="POST" action="stuff.php">
      <font face="Helvetica" color="#000000" size="4"><b> Nom d'utilisateur </b></font><br>

      <input type="text" name="username" value=""><br><br>
      <font face="Helvetica" color="#000000" size="4"><b> Mot de Passe </b></font><br>
      <input type="password" name="password"><br><br><input type="submit" name="submit" value="submit"></form>  <a href="signup.php">Creer un compte</a> 
  </fieldset>
  </div>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.