我在使用了JsFiddle。我将其更改为将div显示为方形对话框(水平和垂直居中)。结果是在。
如你所见,水平居中很容易,但我不能让它垂直居中。有人知道如何用纯CSS做到这一点吗?
编辑代码如下:
<div class="blind">
<div class="wrapper">
<div class="main">
I'm your div with an aspect-ratio of 1:1!
</div>
<
h1标签中的标题在视口中居中。然后,有一个文本区域,它与标题对齐,并在视口中居中。如何在不改变文本区居中的情况下,在文本区的左侧定位一个带数字(例如12)的跨度?
enter code here
此标题在视口中居中
12 This textarea should be centered and aligned with the title
我需要有一个div,它的内容总是相对于屏幕居中,但我也有其他的div在我想要居中的左侧。如果我只是将" center“div的内容居中,它将相对于div宽度居中,而不是屏幕。
我尝试过的
我想要的是这样的东西..。
| true center |
|left div| centered D |
|longer left div| center
我有一个div,里面有很多东西,我想要做的是在上面放一个图像,居中。我的基本布局如下所示:
<div>
<img style="display:block; position: absolute; top:50%; left:50%; margin-top:-33px; margin-left:-33px;" src="Images/ajax-loader_001.gif" />
<!-- a bunch of tables and stuff that doesn't have a conveniently