如何在页面中心放置一个表单 [英] How To Put A Form In The Center Of The Page with

查看:81
本文介绍了如何在页面中心放置一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!



请问如何使用HTML& amp ;;表格将表格放在网页的中心位置? CSS?



请访问此网站以获取示例: http:// www .rhapsodyofrealities.org / onlinereachout2013 / [ ^ ]



谢谢。

解决方案

我终于做到了!



这是解决方案,它适合< div>准确地标记在页面的中心。



 <  < span class =code-leadattribute> div     class   = 居中 >  <   / div  >  







居中 {
< span class =code-attribute> position 绝对;
< span class =code-attribute> width 100px;
< span class =code-attribute> height 100px;
< span class =code-att ribute> left 50%;
top 50%;
margin-left - 50px;
margin-top - 50px;
}







非常感谢你们!


这比初看起来有点困难,中心标签不会真正起作用。请考虑以下代码:



 <   html    >  
< head >
< title > ??? < / title >
< meta http-equiv = 内容类型 content = text / html的; charset = utf-8 / > ;
< style 类型 = text / css > <! -
center {
< span class =code-attribute> margin-top 10px;
margin-left auto;
margin-right auto;
text-align center;
border solid 1px black ;
width 828px ;
height 20px ; }
- > < / style >
< / head >
< body < span class =code-keyword>>

< div class = <跨度lass =code-keyword> center > 它适用于您要放置在此处的任何内部HTML ... < / div >

< / body >
< / html >





有这个主意吗?



-SA

Hello!

Please how do I position a form to be in the center of a webpage, using HTML & CSS?

Kindly visit this site for an example: http://www.rhapsodyofrealities.org/onlinereachout2013/[^]

Thank you.

解决方案

I finally did it!

Here is the solution, it fits the <div> tag exactly in the center of the page.

<div class="centered"></div>




.centered{
    position:absolute;
    width:100px;
    height:100px;
    left:50%;
    top:50%;
    margin-left:-50px;
    margin-top:-50px;
}




Thank you so much guys!


This is a bit harder to achieve than it may seem at first glance, and center tag won't really work. Please consider this code:

<html >
	<head>
		<title>???</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<style type="text/css"><!--
			.center {
				margin-top:10px;
				margin-left:auto;
				margin-right:auto;
				text-align:center;
				border:solid 1px black;
				width:828px;
				height:20px;}
		--></style>
	</head>
<body>

<div class="center">It will work for any inner HTML you want to place here...</div>

</body>
</html>



Got the idea?

—SA


这篇关于如何在页面中心放置一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆