2016-11-23 53 views
0

中心我儘量讓我的網頁上的一個更好的佈局,所以我希望把兩個div在我的html頁面的中心。我無法訪問我的css文件。是否有可能將兩個div放在一個頁面中,而不用css代碼?2的div在html頁面

這是我的代碼:

<div style="width: 100%;"> 
 
<div style="; width: 100%;"> 
 
<h1 style="text-align: center;">This is Web Page Main tit</h1> 
 

 
<div style="position: relative; 
 
    float: left; 
 
    left: 0px; 
 
    width: 470px; 
 
    height: 470px; 
 
    margin: 0 auto; 
 
    background-color: #828282"> 
 
<div><strong>Main Menu</strong></div> 
 
    </div> 
 

 
<div style="position: relative; 
 
    float: left; 
 
    margin: 0 auto; 
 
    left: 0px; 
 
    width: 470px; 
 
    height: 470px; 
 
    background-color: #828282"> 
 
<p>oke and Managerial Tutorials</p> 
 
</div> 
 

 
</div> 
 
<div style="background-color: #b5dcb3; clear: both;">Here text</div> 
 
</div>

+2

爲什麼在世界上,你無法訪問你的CSS?這聽起來太離奇了,不過是一個愚蠢的任務,或類似的... – junkfoodjunkie

回答

0

兩年<div>的旁邊,在彼此的頁面的中心對齊:

<center> 
<div> 
<div style="display: inline-block"> 
<!-- div 1 contents -->  
</div> 
<div style="display: inline-block"> 
<!-- div 2 contents --> 
</div> 
</div> 
</center> 
+0

謝謝你的回答。我有一個CMS頁面,但我只能訪問一個html文件。我想要兩個div中心相鄰。可能嗎?隨着你的答案,我可以集中每個div。 – baske

+0

在這裏,你去,編輯帖子,以適應您的要求:D – ZeKalk

0

我知道有一個<center> HTML標記,你可以嘗試,之前放置它,並</center>的div後,你想要爲中心,或者如果也許你仍然可以改變你的內聯樣式,擺脫浮動,清除,定位和添加

div { 
    margin: auto; 
} 

還你有一個流浪分號<div style=";width: 100%;">