HTML样式边际停用表格

HTML样式边际停用表格

我正在尝试将左侧的菜单和一个带有一个选项菜单的文本框对齐,以搜索右侧表单内的记录。但是,当我将表单的页边距设置为负像素时,它不起作用。

这是代码

<%@ 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>

最佳答案

您可以使用以下代码。

<!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>

关于html - HTML样式边际停用表格,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29455618/

10-13 06:37