simpli Posted April 2, 2009 Share Posted April 2, 2009 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 https://forums.phpfreaks.com/topic/152167-can-anyone-help-me-getting-started-with-this-div-css/ Share on other sites More sharing options...
mimintweak Posted April 3, 2009 Share Posted April 3, 2009 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 Link to comment https://forums.phpfreaks.com/topic/152167-can-anyone-help-me-getting-started-with-this-div-css/#findComment-800070 Share on other sites More sharing options...
My220x Posted April 3, 2009 Share Posted April 3, 2009 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 https://forums.phpfreaks.com/topic/152167-can-anyone-help-me-getting-started-with-this-div-css/#findComment-800129 Share on other sites More sharing options...
Yesideez Posted April 3, 2009 Share Posted April 3, 2009 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 https://forums.phpfreaks.com/topic/152167-can-anyone-help-me-getting-started-with-this-div-css/#findComment-800155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.