2017-05-08 21 views
0

私はcssを使用してhtmlウェブページを作成しようとしていますが、Google Chromeのサイトにアクセスしようとすると、ページはスクリーンショット1のように見えますが、 ...彼らは両方クロムにCss​​が正しく表示されない

http://imgur.com/a/XCZQJ

http://imgur.com/a/PSwxU

..私は自分の携帯電話に自分の携帯電話やサファリにクロームで開きちょうど私のラップトップ上のクロムはそれを台無し場合はスクリーンショット2としてそれが動作を表示すると仮定されています

コード:

"連絡先" のスタイルと

position: relative; 
    top: 50px; 
    bottom: 0; 

@import url('https://fonts.googleapis.com/css?family=Lekton'); 
 

 
body{ 
 
\t background-image: url('background.png'); 
 
    background-repeat: no-repeat; 
 
    background-attachment: fixed; 
 
\t background-size: 100%; 
 
\t margin: 0; 
 
\t padding: 0; 
 
\t font-family: 'Lekton', sans-serif; 
 
} 
 

 
button { 
 
    background-color: #4CAF50; 
 
    color: white; 
 
    padding: 14px 10px; 
 
    margin: 8px 0; 
 
    border: none; 
 
    cursor: pointer; 
 
    width: 180px; 
 
} 
 

 
ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    overflow: hidden; 
 
    background-color: black; 
 
} 
 

 
li { 
 
    float: right; 
 
} 
 

 
li a { 
 
    display: block; 
 
    color: white; 
 
    text-align: center; 
 
\t font-family: 'Lekton', sans-serif; 
 
    padding: 14px 16px; 
 
    text-decoration: none; 
 
} 
 

 
li a:hover { 
 
    background-color: #ecf0f1; 
 
} 
 

 
input[type=text], input[type=password] { 
 
    width: 180px; 
 
    padding: 12px 10px; 
 
    margin: 8px 0; 
 
    display: inline-block; 
 
    border: 1px solid #ccc; 
 
    box-sizing: border-box; 
 
\t border: none; 
 
\t background: transparent; 
 
    border-bottom: 2px solid black; 
 
\t width: 200px; 
 
} 
 

 
.login-title{ 
 
\t font-size: 20px; \t 
 
} 
 

 
.contact{ 
 
\t height: 400px; 
 
\t width: 100%; 
 
\t background: white; 
 
\t position: absolute; 
 
\t top: 700px; 
 
\t text-align: center; 
 
\t font-family: 'Lekton', sans-serif; 
 
} 
 

 
.loginBox{ 
 
\t height: 350px; 
 
\t width: 280px; 
 
\t background: transparent; 
 
\t position: relative; 
 
\t top: 50px; 
 
\t bottom: 0; 
 
\t padding: 1rem; 
 
\t text-align: center; 
 
    border-radius: 8px; 
 
\t margin: auto; 
 
} 
 

 
.button5 { 
 
    background-color: transparent; 
 
    color: black; 
 
    border: 2px solid black; 
 
\t width: 180px; 
 
} 
 

 
.button5:hover { 
 
    background-color: black; 
 
    color: white; 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="UTF-8" /> 
 
    <link rel="stylesheet" href="style.css" /> 
 
\t <title>Site</title> 
 
</head> 
 
<body> 
 
\t <ul> 
 
\t \t <li><a href="#home"></a></li> 
 
\t \t <li><a href="#">Login</a></li> 
 
\t </ul> 
 
\t <div class="loginBox"> 
 
\t \t <p class="login-title"><strong>LOGIN</strong></p> 
 
\t \t <input type="text" placeholder="Username"></input> 
 
\t \t <br /> 
 
\t \t <input type="password" placeholder="Password"></input> 
 
\t \t <br /> 
 
\t \t <a href="#login"><button class="button5">Login</button></a> 
 
\t \t <br /> 
 
\t \t <p> - OR - </p> 
 
\t \t <a href="#register"><button class="button5">Register</button></a> 
 
\t \t <br /> 
 
\t </div> 
 
\t <div class="contact"> 
 
\t \t <h2>Contact</h2> 
 
\t </div> 
 
</body> 
 
</html>

+0

スニペットであなたのHTML&CSSを追加し、まだjsfiddle –

+0

ベターのようなあなたのCSS&HTMLコードを追加します(' <を使用します> 'ボタン) – Manngo

+0

ありがとう!私はそれを加えました@Manngo –

答えて

0
position: absolute; 
    top: 700px; 

"loginBox" スタイルで、それはこのように動作することができます。 あなたDON "Tそれらの両方を必要としています。

@import url('https://fonts.googleapis.com/css?family=Lekton'); 
 

 
body{ 
 
\t background-image: url('background.png'); 
 
    background-repeat: no-repeat; 
 
    background-attachment: fixed; 
 
\t background-size: 100%; 
 
\t margin: 0; 
 
\t padding: 0; 
 
\t font-family: 'Lekton', sans-serif; 
 
} 
 

 
button { 
 
    background-color: #4CAF50; 
 
    color: white; 
 
    padding: 14px 10px; 
 
    margin: 8px 0; 
 
    border: none; 
 
    cursor: pointer; 
 
    width: 180px; 
 
} 
 

 
ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    overflow: hidden; 
 
    background-color: black; 
 
} 
 

 
li { 
 
    float: right; 
 
} 
 

 
li a { 
 
    display: block; 
 
    color: white; 
 
    text-align: center; 
 
\t font-family: 'Lekton', sans-serif; 
 
    padding: 14px 16px; 
 
    text-decoration: none; 
 
} 
 

 
li a:hover { 
 
    background-color: #ecf0f1; 
 
} 
 

 
input[type=text], input[type=password] { 
 
    width: 180px; 
 
    padding: 12px 10px; 
 
    margin: 8px 0; 
 
    display: inline-block; 
 
    border: 1px solid #ccc; 
 
    box-sizing: border-box; 
 
\t border: none; 
 
\t background: transparent; 
 
    border-bottom: 2px solid black; 
 
\t width: 200px; 
 
} 
 

 
.login-title{ 
 
\t font-size: 20px; \t 
 
} 
 

 
.contact{ 
 
\t height: 400px; 
 
\t width: 100%; 
 
\t background: white; 
 
\t text-align: center; 
 
\t font-family: 'Lekton', sans-serif; 
 
    margin:auto; 
 
} 
 

 
.loginBox{ 
 
\t height: 350px; 
 
\t width: 280px; 
 
\t background: transparent; 
 
\t padding: 1rem; 
 
\t text-align: center; 
 
    border-radius: 8px; 
 
\t margin: auto; 
 
} 
 

 
.button5 { 
 
    background-color: transparent; 
 
    color: black; 
 
    border: 2px solid black; 
 
\t width: 180px; 
 
} 
 

 
.button5:hover { 
 
    background-color: black; 
 
    color: white; 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="UTF-8" /> 
 
    <link rel="stylesheet" href="style.css" /> 
 
\t <title>Site</title> 
 
</head> 
 
<body> 
 
\t <ul> 
 
\t \t <li><a href="#home"></a></li> 
 
\t \t <li><a href="#">Login</a></li> 
 
\t </ul> 
 
\t <div class="loginBox"> 
 
\t \t <p class="login-title"><strong>LOGIN</strong></p> 
 
\t \t <input type="text" placeholder="Username"></input> 
 
\t \t <br /> 
 
\t \t <input type="password" placeholder="Password"></input> 
 
\t \t <br /> 
 
\t \t <a href="#login"><button class="button5">Login</button></a> 
 
\t \t <br /> 
 
\t \t <p> - OR - </p> 
 
\t \t <a href="#register"><button class="button5">Register</button></a> 
 
\t \t <br /> 
 
\t </div> 
 
\t <div class="contact"> 
 
\t \t <h2>Contact</h2> 
 
\t </div> 
 
</body> 
 
</html>

+0

私は" Run code snippet "を押してもうまく動作し、私の兄弟のラップトップから離れていれば表示されますが、クロームで開くとスクリーンショット1 –

+0

ブラウザのCSSを無効にしたことがありますか?http://stackoverflow.com/questions/14046738/how-to-disable-css-in-testing-purpose –

+0

またはキャッシュをクリアする必要があります –

関連する問題