2016-10-13 3 views
0

Ich versuche, die rechte Seite des Bildes auf der Unterseite des div-Tags mit Css .up in meinem Stil-Tag zu korrigieren, aber ich finde kein Glück, um die iamge.Can any helfen Sie mir, wie kann ich die rechte Seite Bild nach unten mit Randmargin-bottom: 100px funktioniert nicht

<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <title>Bootstrap Case</title> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
    <style> 
 
    div.round1 { 
 
     border: 1px solid deepskyblue; 
 
     border-radius: 4px; 
 
     height: 170px; 
 
     width: 30%; 
 
     margin: auto; 
 
    } 
 
    .up { 
 
     margin-bottom: 350; 
 
    } 
 
    </style> 
 
</head> 
 

 
<body> 
 

 
    <div class="round1"> 
 

 
    <table> 
 
     <tr> 
 
     <td> 
 
      <img src="https://placeholdit.imgix.net/~text?txtsize=12&txt=128%C3%97128&w=128&h=128" alt="Mountain1" style="width:128px;height:128px;"> 
 
      <br>If a browser cannot find an image, it will display the alternate text 
 
     </td> 
 

 
     <td> 
 
      <img class="up" src="https://placeholdit.imgix.net/~text?txtsize=15&txt=138%C3%9770&w=138&h=70" style="width:138px;height:70px;"> 
 
     </td> 
 
     </tr> 
 

 
    </table> 
 
    </div> 
 

 
    <br> 
 
    <div align="left"> 
 
    <div class="container"> 
 
     <ul class="nav nav-tabs"> 
 
     <li class="active"><a data-toggle="tab" href="#home">One</a> 
 
     </li> 
 
     <li><a data-toggle="tab" href="#menu1">Two</a> 
 
     </li> 
 
     <li><a data-toggle="tab" href="#menu1">Functional</a> 
 
     </li> 
 
     <li><a data-toggle="tab" href="#menu3">Three</a> 
 
     </li> 
 
     </ul> 
 

 
     <div class="tab-content"> 
 
     <div id="home" class="tab-pane fade in active"> 
 
      <h3>One</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text.</p> 
 
     </div> 
 
     <div id="menu1" class="tab-pane fade"> 
 
      <h3>Two</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text</p> 
 
     </div> 
 
     <div id="menu2" class="tab-pane fade"> 
 
      <h3>Three</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text</p> 
 
     </div> 
 
     <div id="menu3" class="tab-pane fade"> 
 
      <h3>Others</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text</p> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
</body> 
 

 
</html>

+0

Stellen Sie eine jsfiddle Verbindung zur Verfügung. –

+0

versuchen, die 'td' css von' vertical-align: top' zu geben, die sicherstellen wird, dass der Inhalt am oberen Rand des 'td' beginnt, siehe hier: http://www.w3schools.com/cssref/pr_pos_vertical-align .asp –

+1

Ich glaube, dass Sie das px in der Rand-Unterseite vermissen. –

Antwort

1

Sie vergessen px verwenden erhalten ändern Sie Ihren Code:

.up { 
    margin-bottom:350**px**; 
} 
0

können Sie Ihre tdvertical-align:bottom geben, die sicher das rechte Bild auf den Boden kleben immer machen wird, unabhängig von der Differenz in den Größen

es ist immer besser, eine dynamische Lösung

<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <title>Bootstrap Case</title> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
    <style> 
 
    div.round1 { 
 
     border: 1px solid deepskyblue; 
 
     border-radius: 4px; 
 
     height: 170px; 
 
     width: 30%; 
 
     margin: auto; 
 
    } 
 
    td{ /*add this*/ 
 
     vertical-align:bottom; 
 
    } 
 
    .up { 
 
     /*margin-bottom: 350; -- don't use both*/ 
 
    } 
 
    </style> 
 
</head> 
 

 
<body> 
 

 
    <div class="round1"> 
 

 
    <table> 
 
     <tr> 
 
     <td> 
 
      <img src="https://placeholdit.imgix.net/~text?txtsize=12&txt=128%C3%97128&w=128&h=128" alt="Mountain1" style="width:128px;height:128px;"> 
 
      <br>If a browser cannot find an image, it will display the alternate text 
 
     </td> 
 

 
     <td> 
 
      <img class="up" src="https://placeholdit.imgix.net/~text?txtsize=15&txt=138%C3%9770&w=138&h=70" style="width:138px;height:70px;"> 
 
     </td> 
 
     </tr> 
 

 
    </table> 
 
    </div> 
 

 
    <br> 
 
    <div align="left"> 
 
    <div class="container"> 
 
     <ul class="nav nav-tabs"> 
 
     <li class="active"><a data-toggle="tab" href="#home">One</a> 
 
     </li> 
 
     <li><a data-toggle="tab" href="#menu1">Two</a> 
 
     </li> 
 
     <li><a data-toggle="tab" href="#menu1">Functional</a> 
 
     </li> 
 
     <li><a data-toggle="tab" href="#menu3">Three</a> 
 
     </li> 
 
     </ul> 
 

 
     <div class="tab-content"> 
 
     <div id="home" class="tab-pane fade in active"> 
 
      <h3>One</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text.</p> 
 
     </div> 
 
     <div id="menu1" class="tab-pane fade"> 
 
      <h3>Two</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text</p> 
 
     </div> 
 
     <div id="menu2" class="tab-pane fade"> 
 
      <h3>Three</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text</p> 
 
     </div> 
 
     <div id="menu3" class="tab-pane fade"> 
 
      <h3>Others</h3> 
 
      <p>If a browser cannot find an image, it will display the alternate textIf a browser cannot find an image, it will display the alternate text</p> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
</body> 
 

 
</html>
haben

Verwandte Themen