2016-03-30 31 views
1

Bu, html kodumda, #login kimliğini doğruca kaydırmak için ayarlıyorum. İşte Float özelliği benim css'de çalışmıyor

#login{ 
      background-color: #00FFFF; 
      float: right; 
      width: 70%; 
      height: 40%; 
      position: absolute; 
      z-index: 2; 
     } 

    #about-blog{ 
      background-color: #A4DDED; 
      width: 30%; 
      height: 50%; 
      position: absolute; 
      z-index: 1; 
     } 

{ı sağladık kod aşağıda daha bilgi} tam kod yapabilirim sağa giriş ayarlamak nasıl

<<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta charset="utf-8"> 
 
\t <title>Kvians-Home</title> 
 
\t <style type="text/css"> 
 
     body { 
 
      \t background-color: #F0FFF0; 
 
      \t color: rgb(255,255,255); 
 
      \t font-family: monospace; 
 
      \t font-style: italic; 
 
      \t font-weight: bold; 
 
      \t font-size: 20px; 
 
     } 
 
     .main-heading { 
 
      \t background-color: #0048ba; 
 
      \t text-align: center; 
 
      \t font-size: 35px; 
 
      \t font-weight: bold; 
 
      \t margin: 0px; 
 
     } 
 
     #login{ 
 
      \t background-color: #00FFFF; 
 
      \t float: right; 
 
      \t width: 70%; 
 
      \t height: 40%; 
 
      \t position: absolute; 
 
      \t z-index: 2; 
 
     } 
 
     #about-blog{ 
 
      \t background-color: #A4DDED; 
 
      \t width: 30%; 
 
      \t height: 50%; 
 
      \t position: absolute; 
 
      \t z-index: 1; 
 
     } 
 
     /* all about links */ 
 
     a{ 
 
      \t background-color: #00FF00; 
 
      \t color: #00693E; 
 
      \t font-weight: Bold; 
 
      \t font-size: 25px; 
 
     } 
 
     a:visited{ 
 
      background-color: #DFFF00; 
 
      color: #FF7F00; 
 
     } 
 
     a:hover{ 
 
     \t background-color: #91A3B0; 
 
     \t color: rgb(0,0,0); 
 
     } 
 
     .left-margin{ 
 
     \t margin-left: 5px; 
 
     } 
 
     /* all about links*/ 
 
     </style> 
 
</head> 
 
<body> 
 
<!--facebook SDK--> 
 

 
<!-- Facebook SDK end--> 
 
    <!--page begin--> 
 
    <h1 class="main-heading">Here You Will Get</h1> 
 
    <!--Main Body Design--> 
 
    <div id="about-blog"> 
 
     <h2 class="left-margin">School Feeds</h2> 
 
     <p class="about-blog-para-one left-margin"> Visit our awesome blog,<br> here you will get updates about school</p> 
 
     <a class="left-margin school-feeds"href="http://kvians.weebly.com/school-feeds" target="_blank">Visit</a> 
 
    </div> 
 

 
    <div id="login"> 
 
     <h2>Login</h2> 
 
     <p>Login to <strong>Kvians</strong> from your facebook account, just click the login button here</p> 
 
    </div> 
 

 
</body> 
 
</html>

Ve sadece tarafından blog hakkında üst üste birkaç pixles.

+0

Gelecekteki kullanıcıların bilmesi gerekenler için, lütfen sorunuzun en iyi çözümü olan bir cevabı kabul edin. – LGSon

cevap

0

position: absolute'u da kullandığınız için kayanız çalışmıyor.

Ben sadece size yolda sorunları verecek şekilde, position: absolute kaldırıldı ve ilave bilgileri eklemek istiyorsanız, düzgün akacaktır, bu yolla, #about-blog için float: left eklendi.

#login{ 
    background-color: #00FFFF; 
    float: right; 
    width: 70%; 
    height: 40%; 
    z-index: 2; 
} 
#about-blog{ 
    background-color: #A4DDED; 
    width: 30%; 
    height: 50%; 
    float: left;   /* added */ 
    z-index: 1; 
} 

body { 
 
    background-color: #F0FFF0; 
 
    color: rgb(255,255,255); 
 
    font-family: monospace; 
 
    font-style: italic; 
 
    font-weight: bold; 
 
    font-size: 20px; 
 
} 
 
.main-heading { 
 
    background-color: #0048ba; 
 
    text-align: center; 
 
    font-size: 35px; 
 
    font-weight: bold; 
 
    margin: 0px; 
 
} 
 
#login{ 
 
    background-color: #00FFFF; 
 
    float: right; 
 
    width: 70%; 
 
    height: 40%; 
 
    z-index: 2; 
 
} 
 
#about-blog{ 
 
    background-color: #A4DDED; 
 
    width: 30%; 
 
    height: 50%; 
 
    float: left; 
 
    z-index: 1; 
 
} 
 
/* all about links */ 
 
a{ 
 
    background-color: #00FF00; 
 
    color: #00693E; 
 
    font-weight: Bold; 
 
    font-size: 25px; 
 
} 
 
a:visited{ 
 
    background-color: #DFFF00; 
 
    color: #FF7F00; 
 
} 
 
a:hover{ 
 
    background-color: #91A3B0; 
 
    color: rgb(0,0,0); 
 
} 
 
.left-margin{ 
 
    margin-left: 5px; 
 
} 
 
/* all about links*/
<!--facebook SDK--> 
 

 
<!-- Facebook SDK end--> 
 
    <!--page begin--> 
 
    <h1 class="main-heading">Here You Will Get</h1> 
 
    <!--Main Body Design--> 
 
    <div id="about-blog"> 
 
     <h2 class="left-margin">School Feeds</h2> 
 
     <p class="about-blog-para-one left-margin"> Visit our awesome blog,<br> here you will get updates about school</p> 
 
     <a class="left-margin school-feeds"href="http://kvians.weebly.com/school-feeds" target="_blank">Visit</a> 
 
    </div> 
 

 
    <div id="login"> 
 
     <h2>Login</h2> 
 
     <p>Login to <strong>Kvians</strong> from your facebook account, just click the login button here</p> 
 
    </div>

2

Eğer position:absolute yerine float:right ait right:0 denemek ve left:0 yerine

-1

float:left bu kodu deneyin kullanıyorsanız:

#login{ 
       background-color: #00FFFF; 
       float: right; 
       clear: right; 
       width: 70%; 
       height: 40%; 
       position: absolute; 
       z-index: 2; 
      } 

Üzerinde clear: right; ekledim, işe yarayacak!

1

position:absolute kullanıyorsanız, yüzen özelliği kullanamazsınız, belge yüzen öğe çalışmaz bu nedenle belgeden çıkarılır.

right:0 veya left:0'u kullanabilirsiniz ve bu öğe belgenin soluna veya sağına gitmek zorunda kalır.