Html 表单的背景
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4199820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Background to a form
提问by user414209
How to have a background to a form and have different image for whole page back ground in html.
如何为表单设置背景并在 html 中为整个页面背景设置不同的图像。
回答by quakkels
You can do this with css.
你可以用 css 来做到这一点。
Place the following into the <head>
of your HTML document:
将以下内容放入<head>
您的 HTML 文档中:
<style>
body{background:url(/path/to/your/body/image.jpg);}
form{background:url(/path/to/your/form/image.jpg);}
</style>
You could also have these styles defined directly on the html tags, like this:
您也可以直接在 html 标签上定义这些样式,如下所示:
<body style="background:url(path/to/your/body/image/jpg);">
and
和
<form style="background:url(path/to/your/form/image/jpg);" method="post" action="your action">
I hope this helps.
我希望这有帮助。
回答by Wouter Dorgelo
In your external css file:
在您的外部 css 文件中:
body {
background: url('body_bg.jpg');
}
form {
background: url('form_bg.jpg');
}
include your external css file like this:
像这样包含您的外部 css 文件:
<head>
<link rel=stylesheet href="style.css" type="text/css" media=screen />
</head>