2013-04-01 67 views
0

單挑:我是新來的這個論壇,英文不是我的主要語言,所以很抱歉,如果它不完全可以理解。CSS按鈕造型不起作用

我正在爲學校的移動網站,它會很遠這麼好......

一個問題:我有一個啄(對不起,不知道它的名字)在我的CSS文件(# styled_button)並且工作正常。有一個按鈕我想定位不同,所以我複製了'#styled_button'的代碼並創建了一個新的東西,並添加了位置:relative;和float:right;但由於某種原因,我的按鈕現在完全沒有風格。 (我確實改變了我的按鈕上的ID)。

編輯:如果我改變我的按鈕id回button_styled它是風格。

即使不更改代碼,所以#logout_button與#button_styled相同,沒有任何反應。

我的按鈕:

<form action='m.member.php' method='POST'> 
    <input type='submit' name='logout_button' value='Logout' id="button_styled"> 
</form> 

CSS:

#button_styled { 
    color:white; 
    background:#666; 
    font: bold 45px Harabara; 
    padding: 20px; 
    text-decoration: none; 
    vertical-align: middle; 
} 

編輯:錯字刪除(wasnt副本從我原來的代碼粘貼),但問題不在於形式,因爲它的工作原理.. 。

如的「brbcode」請求這裏是其他按鈕中的一個的代碼即時通訊使用:

<form action='m.loginscreen.php' method='POST'> 
    <p>Username:</p> 
    <input type='text' name='username' id="styled"> 
    <p>Password:</p> 
    <input type='password' name='password' id="styled"><br> 
    <ul> 
     <li><input type='submit' name="loginbutton" value='Log In'   class="button_styled"></li> 
     <li><input type='submit' name="registerbutton" value='Register' class="button_styled"></li> 
    </ul> 
</form> 

PS:我的英語流利一次抱歉,但對於那些didnt完全理解我的按鈕可它就是造型...

+0

不知道爲什麼它是PHP – samayo

+0

啄=元素標記? –

+0

@DeepakKamat,CSS中沒有「元素」:) –

回答

2

這聽起來像你可能在你的HTML幾個元素使用的ID (?)。 ID只能在每頁使用一次 - 通常情況下,如果您有一個元素與其他元素不同。如果您在多個地方使用button_styled類型,則應將其更改爲。在您的HTML:

<input class="button_styled" ... > 

而在你的CSS:

.button_styled { 
    /* your styling */ 
} 
+1

非常感謝你現在的工作,仍然不能理解如何使用id干擾另一個id,因爲他們之間沒有關係,但非常感謝你。 <3(沒有同性戀) – iDobbler

+0

@iDobbler這是因爲你只能使用一次id,而一次課,無限次。我相信。 –