2016-10-04 99 views
0

如何删除文本框之间的空格?如何删除这些文本框之间的空格?

<form method="post" action="mailto:[email protected]"> 
    <p>First name: <input name="firstname" type="text" size="15"/>Last Name: <input name="lastname" type="text" size="20"/></p> 
    <p>Address: <input name="address" type="text" size="50"/></p> 
    <p>City: <input name="city" type="text" size="25"/></p> 
    <p>State: <input name="state" type="text" size="5"/></p> 
    <p>Zip: <input name="zip" type="text" size="10"/></p> 
    <p>E-mail address: <input name="E-mail" type="text" size="30"/></p> 
    <hr style="size: auto; width: auto;"> 
    </hr> 

    <hr style="size: auto; width: auto;"> 
    </hr> 

回答

0

似乎空间来自每个<p>标签的边缘。删除边际似乎工作。

p { //You'll likely want this to be more specific, like "form p {..." or a class name 
    margin: 0px; 
} 
1

可以使用</br> unstead的<p> </p>这样的:

Address: <input name="address" type="text" size="50"</br> 
City: <input name="city" type="text" size="25"/></br> 

但它会删除所有的空间。

从某个网站:使用<br>标记输入换行符,而不是单独的段落。

0

长期,妥善地

的空间是由你需要使用CSS重置浏览器定义的利润率造成的。这基本上是从一个'干净的板岩'工作,没有浏览器定义你不知道的默认值。

把它放在名为'reset.css'的CSS文件中。

html, body, div, span, applet, object, iframe, 
h1, h2, h3, h4, h5, h6, p, blockquote, pre, 
a, abbr, acronym, address, big, cite, code, 
del, dfn, em, img, ins, kbd, q, s, samp, 
small, strike, strong, sub, sup, tt, var, 
b, u, i, center, 
dl, dt, dd, ol, ul, li, 
fieldset, form, label, legend, 
table, caption, tbody, tfoot, thead, tr, th, td, 
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary, 
time, mark, audio, video { 
    margin: 0; 
    padding: 0; 
    border: 0; 
    font-size: 100%; 
    font: inherit; 
    vertical-align: baseline; 
} 
/* HTML5 display-role reset for older browsers */ 
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section { 
    display: block; 
} 
body { 
    line-height: 1; 
} 
ol, ul { 
    list-style: none; 
} 
blockquote, q { 
    quotes: none; 
} 
blockquote:before, blockquote:after, 
q:before, q:after { 
    content: ''; 
    content: none; 
} 
table { 
    border-collapse: collapse; 
    border-spacing: 0; 
} 

然后将其链接到您的html文件中'head'的顶部。

<link rel="stylesheet" type="text/css" href="reset.css"> 

注:确保复位是加载的第一个样式表。否则一切都会在您做出自己的调整后重置。

短道

为了解决特定于该页面的问题,必须重置所有<p>元素的保证金。在你的CSS文件中:

form p { 
    margin: 0; 
}