页面布局-绝对定位

发布于 2024-08-20 09:52:29 字数 338 浏览 2 评论 0原文

下午好——我真的需要一些建议。

作为一个新手,我现在意识到我用来设计第一个项目的方法有点糟糕。由于对 Web 开发知之甚少/一无所知,我沿着将控件放置在具有绝对定位的页面上的路线......我真的很喜欢拖放的想法!

不管怎样,我现在意识到这并不是我曾经有过的最好的想法,因为不同的用户会有不同的分辨率,而且我看到的不一定是他们会看到的。

我将如何修改我的代码,以便保持控件之间相同的布局/间距,但通常居中?

我是否必须将所有当前控件放入表格或某种容器中,然后对齐?或者,是否完全剥离绝对定位并几乎从头开始?!

任何想法或想法将不胜感激。

(PS:请不要滥用!!!)

Afternoon all - I'm after a bit of advice really.

Being a newbie, I now realise that the method I employed to design my first project is a bit crap. Having little/no knowledge of anything to do with web development, I went down the route of placing my controls on a page with absolute positioning...I just liked the idea of dragging and dropping really!

Anyway, I now realise that this wasn't the greatest idea I ever had given the fact different users will have different resolutions and wot not - what I see isn't necessarily what they will be seeing.

How would I go about amending my code so that the same layout/spacing between controls is maintained but is generally centered?

Would I have to enclose all my current controls in a table or container of some sort and then align this? Alternatively, is it the case of stripping the absolute positioning out entirely and pretty much start from scratch?!

Any thoughts or ideas would be gratefully received.

(PS: Please go easy on the abuse!!!)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太傻旳人生 2024-08-27 09:52:29

创建一个包装器,这是您想要的所有内容的宽度。你把其他所有东西都放进去;您的页眉、内容、页脚以及在其中您可以以“正确”的方式定位。您应该尽可能避免绝对定位,相对定位才是正确的选择,使用包装器您可以轻松做到这一点。

因此,如果您创建一个 1000px 包装器,并且希望标题距左侧 200px,则不必担心分辨率不同;他们总是会看到它显示在距 1000 像素左侧 200 像素的位置,您可以将其置于页面中心。

看一下:https://www.adobe.com/devnet/dreamweaver /articles/css_concepts_pt3_04.htmlhttp://www.communitymx .com/content/article.cfm?cid=A8BBA

:)

Create a wrapper, this is the width you want everything to be. Inside this you put everything else; your header, content, footer and inside this you can position the "right" way. You should avoid absolute positioning as much as possible, relative is the way to go and with wrappers you can easily do this.

So if you create a 1000px wrapper and you want your header to be 200px from the left, you don't have to worry about different resolutions; they will always see it displayed 200px from the left of the 1000px, which you can centre on the page.

Take a look at: https://www.adobe.com/devnet/dreamweaver/articles/css_concepts_pt3_04.html and http://www.communitymx.com/content/article.cfm?cid=A8BBA

:)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文