Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

css float

Posted on 2014-02-21
4
Medium Priority
?
251 Views
Last Modified: 2014-02-21
HI,

I have the following code

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Documento sin título</title>

<link href="test.css" rel="stylesheet">

</head>

<body>
<table width="350" border="1" cellspacing="1" cellpadding="2">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<form id="form1" name="form1" method="post">
  <label for="textfield">Text Field:</label>
  <input type="text" name="textfield" id="textfield">
  <label for="email">Email:</label>
  <input type="email" name="email" id="email">
  <label for="password">Password:</label>
  <input type="password" name="password" id="password">
</form>
<p>&nbsp;</p>
</body>
</html>

Open in new window


and for css
@charset "UTF-8";
/* CSS Document */
#form1{
	float:right'
}

Open in new window


I want the form appears to the right of the table
0
Comment
Question by:joyacv2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Britt Thompson
ID: 39878021
you need to surround your table with a div and then you have to set the widths on the divs. If you don't set the widths it doesn't know where to float.
0
 
LVL 1

Author Comment

by:joyacv2
ID: 39878034
updated code, don't work

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Documento sin título</title>

<link href="test.css" rel="stylesheet">

</head>

<body>
<div width="300px">
<table width="350" border="1" cellspacing="1" cellpadding="2">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table></div>
<form id="form1" name="form1" method="post">
  <label for="textfield">Text Field:</label>
  <input type="text" name="textfield" id="textfield">
  <label for="email">Email:</label>
  <input type="email" name="email" id="email">
  <label for="password">Password:</label>
  <input type="password" name="password" id="password">
</form>
<p>&nbsp;</p>
</body>
</html>

Open in new window

0
 
LVL 30

Accepted Solution

by:
Britt Thompson earned 2000 total points
ID: 39878071
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Documento sin título</title>

<link href="test.css" rel="stylesheet">
<style>
/* CSS Document */
#container { width:525px; margin: 10 auto 0 auto; }
#theTable { width:350px; float: left; }
#theForm{
	float:right;
	width:150px;
}
</style>
</head>

<body>
<div id="container">
<div id="theTable">
<table width="350" border="1" cellspacing="1" cellpadding="2">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table></div>
<div id="theForm">
<form id="form1" name="form1" method="post">
  <label for="textfield">Text Field:</label>
  <input type="text" name="textfield" id="textfield">
  <label for="email">Email:</label>
  <input type="email" name="email" id="email">
  <label for="password">Password:</label>
  <input type="password" name="password" id="password">
</form>
</div>
<p>&nbsp;</p>
</div>
</body>
</html>

Open in new window

0
 
LVL 1

Author Closing Comment

by:joyacv2
ID: 39878128
works perfect!!!!!!!!!!!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question