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> 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.