2015-04-05 37 views
0

我想將左側的菜單和一個文本框與一個選項菜單對齊,以搜索右側窗體中的我的記錄。但是,當我將這個表格留在負像素中時,它不起作用。HTML STYLE MARGIN DISABLE FORM

下面是代碼

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<%@ include file="header.jsp"%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>SEARCH - VMS</title> 

<style> 
input[type=text]{ 
    width: 10%; 
    height: 20px; 
    padding: 5px; 
    margin-bottom: 25px; 
    margin-top: 5px; 

    border: 2px solid #ccc; 
    color: #4f4f4f; 
    font-size: 16px; 
    border-radius: 5px; 
    } 

input[type=submit],input[type=reset]{ 
    border-radius: 7px; 
    -moz-border-radius: 7px; 
    -webkit-border-radius: 7px; 
    background-color: #f6f6f6; 
    cursor: pointer; 
    margin-left: 12px; 
    height: 35px; 
    padding: 5px; 
    width: 100px; 
    } 
</style> 

</head> 



<form name="search" method="post" action="SearchController?op=1"> 

<div style="margin-left: 500px;"> 
SELECT TYPE TO SEARCH DRIVER<br><br> 

<select name="list"> 
<option>dname</option> 
<option>dcontact</option> 
</select> 
<input type="text" name="txtField"> 


<input type="submit" value="Search" name="search"> 
<input type="reset" value = "Reset"> 
</div> 
</form> 
<div style="margin-top: -118px;"> 
<%@ include file="menu.jsp" %> 
</div> 

</html> 

回答

0

您可以使用下面的代碼..

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>SEARCH - VMS</title> 

<style> 
input[type=text]{ 
width: 10%; 
height: 20px; 
padding: 5px; 
margin-bottom: 25px; 
margin-top: 5px; 

border: 2px solid #ccc; 
color: #4f4f4f; 
font-size: 16px; 
border-radius: 5px; 
} 

input[type=submit],input[type=reset]{ 
border-radius: 7px; 
-moz-border-radius: 7px; 
-webkit-border-radius: 7px; 
background-color: #f6f6f6; 
cursor: pointer; 
margin-left: 12px; 
height: 35px; 
padding: 5px; 
width: 100px; 
} 
form{display:block; 
margin-top:-10px;} 
</style> 

</head> 


<body> 
<form name="search" method="post" action="SearchController?op=1"> 

<div> 
SELECT TYPE TO SEARCH DRIVER<br><br> 

<select name="list"> 
<option>dname</option> 
<option>dcontact</option> 
</select> 
<input type="text" name="txtField"> 


<input type="submit" value="Search" name="search"> 
<input type="reset" value = "Reset"> 
</div> 
</form> 
<div> 
<%@ include file="menu.jsp" %> 
</div> 
</body> 
</html>