2017-04-01 60 views
1

我想爲手機創建單獨的頁面它應該被隱藏爲 桌面請參閱我的CSS和HTML這個代碼有什麼錯?隱藏的桌面顯示爲移動css

代碼:

<form class="form-signin-login" method="post" id="login-form"> 
        <input type="text" name="user_entered_id" id="user_entered_id" value="Email (or) Phone No" onblur="if(this.value=='') this.value='Email (or) Phone No'" onfocus="if(this.value =='Email (or) Phone No') this.value=''"> 
        <input type="password" name="lgpassword" id="lgpassword" value="Password" onblur="if(this.value=='') this.value='Password'" onfocus="if(this.value =='Password') this.value=''"> 
        <input type="submit" class="button" name="submit" value="Login"> 
      </form> 

<style> 

body{ 
background-color:#000;} 
    @media screen and (max-width:300px) { 

.input[type=text], .input[type=password]{width: 100%; 
padding: 12px 20px; 
background-color:#000; 
color:#fff; 
outline:none; 
border: none; 
border-bottom: 1px solid #fff; 

margin: 8px 0; 
-webkit-box-shadow: 0 0 0px 1000px black inset; 
-webkit-text-fill-color: white !important; 


    } 
} 

    </style>  
+0

你在綁什麼?整個表單? –

+0

是的,這個CSS只針對移動 –

回答

0

你只是需要添加以下中的CSS

.form-signin-login { display: none;} @media screen and (max-width:300px) { .form-signin-login { display: inline;} }

這裏是工作示例:https://jsfiddle.net/6sz8rnb2/1/

enter image description here

+0

是其隱藏桌面和移動 –

+0

檢查小提琴,形成適用於移動視圖顯示 – selvarajmas

+0

是移動版本也隱藏 –

0

@media添加最小寬度和最大寬度(適用於美孚和桌面),隱藏使用屬性可見性(值:visible |隱藏|崩潰| inherit |);注意:頁面上的所有其他元素不會改變它們的位置。

+0

是不行的,請檢查一次,並告訴我 –

+0

使用輸入和類按鈕的id,所以https://jsfiddle.net/c05yjgsp/1/ –