在绝对定位的迷雾中将div居中的艺术是什么? [英] What is the art of centering a div in the mist of absolute positioning?

查看:64
本文介绍了在绝对定位的迷雾中将div居中的艺术是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是代码:

http:// cartoper.ueuo.com/centering.htm


如何让大蓝色按钮在Firefox上居中并且

Safari就此而言网站?


我知道布局有点复杂,但有理由,

看一下这个网站:

http://pahountis.zenfolio.com/p925877948


我的最终目标是实现类似于这个

站点的流畅图库。我现在看到它的方式,在

contentAll div中放置一个图像div后,我可以使用JavaScript来获取contentAll的大小

div和图像div计算可以适合的图像总数

而不让它们离开页面。是的,我知道这个网站使用了大量的

JavaScript。我的网站将在我能够启用JavaScript的环境中运行




Cartoper

Here is the code:

http://cartoper.ueuo.com/centering.htm

How do I get the big blue buttons to center themselves on Firefox and
Safari on this web site?

I know that the layout is a bit complex, but there is a reason for it,
have a look at this site:

http://pahountis.zenfolio.com/p925877948

My final objective is to implement a fluid gallery similar to this
site. The way I am seeing it now, after placing one image div in the
contentAll div, I can use JavaScript to get the size of the contentAll
div and the image div to calculate the total number of images can fit
without them leaving the page. Yes, I know this site uses a ton of
JavaScript. My site will be running in an environment where I am able
to require JavaScript to be enabled.

Cartoper

推荐答案

Cartoper写道:
Cartoper wrote:

这是代码:
Here is the code:



为什么你不能坚持一个线程?如果这对你来说太难了,

会得到一个真正的新闻阅读器并停止使用那个糟糕的Google网上论坛界面。


你_are_意识到这是Usenet,而不是Google ,不是吗?


-

-bts

-Motorcycles无视重力;汽车只是吮吸

Why can''t you stick to one thread? If this is too difficult for you,
get a real newsreader and stop using that awful Google Groups interface.

You _are_ aware this is Usenet, not Google, aren''t you?

--
-bts
-Motorcycles defy gravity; cars just suck


9月30日上午9:56,Beauregard T. Shagnasty

< a.nony.m。 .. @ example.invalidwrote:
On Sep 30, 9:56 am, "Beauregard T. Shagnasty"
<a.nony.m...@example.invalidwrote:

Cartoper写道:
Cartoper wrote:

这是代码:
Here is the code:



为什么你不能坚持一个线程?


Why can''t you stick to one thread?



同样的原因我会不时地通过代码

并重新开始:事情变得陈旧,偏离主题,并且断章取义。

有时你只需要开始新的和新的来获得新的想法

和关于某个主题的想法。我只是想重新关注手头上真正的问题,如何将我需要的东西集中在中心而不是

然后专注于我的像素计数的哲学。

The same exact reason why I will, from time to time, through out code
and start over: Things get old, off topic, and out of context.
Sometimes you simply need to start fresh and new to get new thoughts
and ideas on a subject. I am simply trying to refocus on the real
question at hand, how to center the things I needed centered rather
then focusing on my philosiphy of pixel counting.


你_are_意识到这是Usenet,而不是谷歌,不是吗?
You _are_ aware this is Usenet, not Google, aren''t you?



我有可能比你更长时间使用网络了,不要知道...我一直在使用自90年代初以来的Usenet。我所拥有的是什么?b $ b发现有趣的是,我多年来工作的地方

不允许NTP通过他们的防火墙,但他们确实允许HTTP!那个

以及谷歌(和当天的Deja News)如何跟踪我所有的b
发布,我只是喜欢他们的界面。


Cartoper

There is a chance I have been around the usenet longer then you, don''t
know... I have been using Usenet since the early 90''s. What I have
found interesting is that the places I have worked over the years
don''t allow NTP through their firewall, but they do allow HTTP! That
and how Google (and Deja News back in the day) keeps track of all my
posting, I have simply come to like their interface.

Cartoper


文章

< 11 ********** ***********@k79g2000hse.googlegroups。 com>,

Cartoper< ca ****** @ gmail.comwrote:
In article
<11*********************@k79g2000hse.googlegroups. com>,
Cartoper <ca******@gmail.comwrote:

以下是代码:

http://cartoper.ueuo.com/centering.htm


如何在这个网站上让大蓝色按钮集中在Firefox和

Safari上?
Here is the code:

http://cartoper.ueuo.com/centering.htm

How do I get the big blue buttons to center themselves on Firefox and
Safari on this web site?



你已经改变了线程。我看过B查询这个和

我同意,它失去了连续性,特别是它失去了你不想简化你的html,至少要开始关闭

简单并从那里建立直到你遇到问题。我花了一些html和css为你考虑作为一个

的起点,但你想要的似乎是一个修复的东西。

为你的

目前,即。一些最小的东西,将使那些蓝色按钮

移动到FF和Safari的中心(我们也可能添加:iCab,

Opera和其他相当不错的标准兼容

浏览器)。你好像没有意识到这种事情是实际上并不是非常有用,如果你添加骑手并且修复

一定不会产生意想不到的后果。因为,给定

上下文,修复将在,即。你过于复杂的代码,很难保证很难保证。


你有一套蓝色按钮,一个在另一个下面。对于每个

,有一个由div包围的锚点所包围的跨度;然后

所有按钮都由另一个div共同包围,然后

后面被另一个div包围了更多...

所有这些div的功能和推理都不是很清楚。


好​​的,你想要一件让按钮全部移动到

中心的东西Firefox浏览器。这样做,删除你的:


div #main div

{

保证金:0;

填充:5px;

}


完全来自css。如果没有这个,他们就会在FF的机器上进入

中心。


但是,对于未来我们是否真的更聪明?


-

dorayme

You have changed the thread. I have looked at B querying this and
I agree, it loses continuity, in particular it loses that you are
unwilling to simplify your html, at the very least to start off
simple and build from there till you strike a problem. I went to
the trouble of making some html and css for you to consider as a
starting point, but what you want seems to be a "fix" for your
present, ie. some minimal thing that will make those blue buttons
move to the centre in FF and Safari (and we might also add: iCab,
Opera and probably other quite good and standards compliant
browsers). You seem not to appreciate that this sort of thing is
actually not very useful if you add the rider that "and the fix
must not have unintended bad consequences". Because, given the
context the fix will be in, ie. your over complicated code, it is
a very difficult to guarantee.

You have a set of blue buttons, one under the other. For each
there is a span surrounded by an anchor surrounded by a div; then
all buttons are surrounded collectively by another div, and the
latter is then surrounded by yet another div and more... The
function and reasoning of all these divs is not really very clear.

OK, you want one thing that will make the buttons all move to the
centre in Firefox. Do this, remove your:

div#main div
{
margin: 0;
padding: 5px;
}

entirely from the css. The absence of this makes them go to the
centre on my machine in FF.

But are we any the wiser really for the future?

--
dorayme


这篇关于在绝对定位的迷雾中将div居中的艺术是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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