我有兩個對象需要水平對齊,如同一行/內嵌。如何水平和垂直對齊?
如何做到這一點?行跨並不適用於我。謝謝
像這樣:
這裏的site
CSS:
.metaslider {
position: relative;
z-index: 0;
left: 300px;
margin-top:0px;
}
我有兩個對象需要水平對齊,如同一行/內嵌。如何水平和垂直對齊?
如何做到這一點?行跨並不適用於我。謝謝
像這樣:
這裏的site
CSS:
.metaslider {
position: relative;
z-index: 0;
left: 300px;
margin-top:0px;
}
那麼這個CSS添加到cp_cff_clean
float: left;
然後也加入這個CSS來huge_it_slideshow_image_wrap_1
position: absolute;
right: 0px;
這應該做工精細,測試您的網站
我無法在.css中找到huge_it_slideshow_image_wrap_1 hmm – User014019 2014-10-07 03:39:35
我的意思是容器在右側包含幻燈片 – Ahmad 2014-10-07 10:41:48
包裹ID fbuilder和一個師級huge_it_slideshow_image_wrap_1。給那個div寬度:100%。之後添加float:留在id fbuilder和類huge_it_slideshow_image_wrap_1中。這將使兩者在同一行中。我希望這會起作用。如果沒有,請告訴我們。
艾哈邁德解決方案也可以在這裏工作。 – SPViradiya 2014-10-07 03:23:33
但我無法找到css文件中的huge_it_slideshow_image_wrap_1 – User014019 2014-10-07 03:40:03
可能是從js文件添加的。無論如何直接寫入.huge_it_slideshow_image_wrap_1 {float:left}。 – SPViradiya 2014-10-07 05:07:04
好的。我現在解決的,通過把這個
position: absolute;
right: 50px;
top: 300px;
z-index: -1;
如果塊是固定的高度和寬度,你可以使用CSS 父級(容器)的絕對位置必須有相對位置和其他元素都有絕對的。
看看我的代碼在CSS,元素有頂部:50%從他們的容器50%,爲垂直對齊,你應該添加半高地雷元素。如果你想要一個元素對齊水平,你應該做的,對於具有
HTML:
<div class="Container">
<div class="LeftBlock">Left Block</div>
<div class="RightBlock">Right Block</div>
</div>
CSS:
div.Container {
overflow: hidden;
width: 500px;
border: 1px solid #ccc;
padding: 10px;
height: 300px;
margin: 0px auto;
position:relative
}
div.LeftBlock, div.RightBlock {
width: 200px;
height: 150px;
background: #fc0;
border: 1px solid #B99504;
text-align: center;
line-height:150px;
color:#333;
font-family: tahoma;
position: absolute;
top: 50%;
margin-top: -75px;
}
div.LeftBlock {
left:10px;
}
div.RightBlock {
right: 10px;
}
我們希望你把有關OP中的代碼,以便問題仍然有用。在這種情況下,只要你修復你的網站,這個問題就變得對其他人毫無用處。閱讀並遵循:http://stackoverflow.com/help/mcve – Sparky 2014-10-07 03:18:35