如何将我的网站设置在浏览器中间? [英] How to set my website to be in the middle of the browser?

查看:91
本文介绍了如何将我的网站设置在浏览器中间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,



我觉得我对网络开发很新,虽然我可能会问一些白痴问题,所以请耐心等待。



我使用Visual Studio 2003,ASP.Net和Visual Basic代码开发了我的网页。现在我需要的是,当我将这个网页加载到浏览器中时,它显示在浏览器的中间,而不是现在的左侧。有没有简单的方法呢?





提前谢谢...

解决方案

一种方法(我通常这样做)是有一个固定宽度的容器div,其左右边距设置为auto。您可以下载基本布局:

这里 [ ^ ]

虽然你可能会发现它的父母画廊 [ ^ ]如果您有页眉和页脚等,则非常有用。







Html是:

 <   html  >  
< link rel = stylesheet type = text / css href = main.css / >
< / head >


< body >

<! - Begin Wrapper - >
< div id = 包装 >

<! - 开始内容 - >
< div id = 内容 >
您的主要内容在此处
< / div >
<! - 结束内容 - >

< / div >
<! - < span class =code-keyword> 结束包装 - >

< / body >
< / html > ;



上面创建了一个div to wrapper(称为 wrapper )你要放入的所有内容中间。您可能希望在此包装器中放置多个div(对于标头,内容和页脚)。我只留下了内容(称为 content )。要将页面上的包装器(包括其子页眉页脚和内容)居中,给它一个固定的宽度并设置其左边/右边距自动。



css:



  *  { padding    0 ;   margin    0; } 

body {
background-color 绿色;
}

包装器 {
margin 0 auto;
width 922px;

background-color 红色;
}

content {
background 黄色;
}





这是我第一个链接中模板的简化版本。


hi。

< center> html中的标签是将页面设置在中心的简单方法。



< body>之后标签插入< center>标记和结束标记< / boby>输入< / center>。


您可以将内容放在一个分区中,然后将分区对齐在中心。这是一个提示。希望它可以提供帮助。 :)

Greetings,

I think I`m very new to web development and though I may ask some idiot questions, so please bear with me.

I have developed my web page using Visual Studio 2003, ASP.Net & Visual Basic code. Now what I need is that when I load this web page into the browser it shows in the middle of the browser and not on the left as it is now. Is there any simple way to do so?


Thanks in advance...

解决方案

One way to do it (the way I normally do) is to have a fixed-width container div with its left and right margins set to auto. You can dowload a basic layout:
Here[^]
though you might find its parent gallery [^]useful if you have header and footers etc.

[Edit]

The Html is:

<html>
  <link rel="stylesheet" type="text/css" href="main.css" />
</head>


<body>

   <!-- Begin Wrapper -->
   <div id="wrapper">

         <!-- Begin Content -->
         <div id="content">
            Your main content goes here
         </div>
         <!-- End Content -->

   </div>
   <!-- End Wrapper -->

</body>
</html>


The above creates a div to wrapper (called wrapper) everything you want to put in the middle. It is likely that you will want to put more than one div in this wrapper (for header, content and footer). I have only left the content (called content) in. To center the wrapper on the page (including its child header footer and content) give it a fixed width and set its left/right margins to auto.

The css:

* { padding: 0; margin: 0; }

body {
	background-color:Green;
}
 
#wrapper {
 margin: 0 auto;
 width: 922px;
 background-color:Red;
}

#content {
 background: Yellow;
}



This is a simplified version of the template in my first link.


hi.
the <center> tag in html side is simple way to set your page in center.

after <body> tag insert <center> tag and befor end tag </boby> enter </center>.


you can place your content in a division then align the division in the center. it is a hint. hope it can help. :)


这篇关于如何将我的网站设置在浏览器中间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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