2017-08-03 16 views
3

私はmaterializeCSSの2つの異なる部分を結合しようとしています。水平FABと、写真とテキストの中央にあるボタン付きカード。 this is the result I like to haveMaterializeCSSはカードの中央に水平FABを設定します

しかし、これはあるが<a class="btn-floating halfway-fab waves-effect waves-light red"><i class="material-icons">add</i></a>

彼の制限をぐるぐる何「」タグである私は本当に近いですが、最後の部分を見つけることができません。 I have this result

そして、私は次のコードを使用していますが:

$(document).ready(function(){ 
 
     $(".button-collapse").sideNav() 
 
    }); 
 
    $('.dropdown-button').dropdown({ 
 
      inDuration: 300, 
 
      outDuration: 225, 
 
      constrainWidth: false, // Does not change width of dropdown to that of the activator 
 
      hover: true, // Activate on hover 
 
      gutter: 0, // Spacing from edge 
 
      belowOrigin: false, // Displays dropdown below the button 
 
      alignment: 'left', // Displays dropdown with edge aligned to the left of button 
 
      stopPropagation: false // Stops event propagation 
 
     } 
 
    );
.btn-card-midle{ 
 
    transform: scaleY(0.4) scaleX(0.4) translateY(0px) translateX(20px); 
 
    opacity: 0; 
 
} 
 

 
.btn-holder{ 
 
    position: absolute; 
 
    display: inline-block; 
 

 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="UTF-8"> 
 
    <title>CMS</title> 
 
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> 
 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css"> 
 
    <link type="text/css" rel="stylesheet" href="css/style.css"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 
 
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.js"></script> 
 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script> 
 
</head> 
 
<body> 
 
<!-- navigatie --> 
 
<nav class="nav-extended"> 
 
    <div class="nav-wrapper"> 
 
     <a href="#" class="brand-logo ">CMS</a> 
 
     <ul id="nav-mobile" class="right hide-on-med-and-down"> 
 
      <li><a><i class="material-icons">settings</i></a></li> 
 
      <li><a><i class="material-icons">close</i></a></li> 
 
     </ul> 
 
    </div> 
 
    <div class="nav-content" id="tab_menu"> 
 
     <ul class="tabs tabs-transparent"> 
 
      <li class="tab"><a class="active" href="#test1">Statics</a></li> 
 
      <li class="tab"><a href="#test2">Edit</a></li> 
 
     </ul> 
 
    </div> 
 
</nav> 
 
<main> 
 
    <div id="test1" class="col s12"> 
 
</div> 
 
<div id="test2" class="col s12"> 
 
    <div class="row"> 
 
    <div class="col s12 m3"> 
 
     <div class="card"> 
 
      <div class="card-image"> 
 
       <img src="https://static1.squarespace.com/static/54bff0d3e4b03c2b708fee78/54dce804e4b0208bec0e6939/5554fca4e4b01c8cda5a5d55/1499833385964/log+cabin+exterior.jpg"> 
 
       <span class="card-title">Card Title</span> 
 
       <div class="fixed-action-btn btn-holder horizontal"> 
 
        <a class="btn-floating btn-large red"> 
 
         <i class="large material-icons">mode_edit</i> 
 
        </a> 
 
        <ul> 
 
         <li><a class="btn-floating btn-card-midle red"><i class="material-icons">insert_chart</i></a></li> 
 
         <li><a class="btn-floating btn-card-midle yellow darken-1" ><i class="material-icons">format_quote</i></a></li> 
 
         <li><a class="btn-floating btn-card-midle green"><i class="material-icons">publish</i></a></li> 
 
         <li><a class="btn-floating btn-card-midle blue" ><i class="material-icons">attach_file</i></a></li> 
 
        </ul> 
 
       </div> 
 

 
      </div> 
 
      <div class="card-content"> 
 
       <p>I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively.</p> 
 
      </div> 
 
     </div> 
 
    </div> 
 
</div> 
 
    <div class="fixed-action-btn" onclick="$('.tap-target').tapTarget('open');" > 
 
     <a id="menu" class="btn btn-floating btn-large red"><i class="material-icons">plus_one</i></a> 
 
    </div> 
 
    <div class="tap-target-wrapper circle-open "><div class="tap-target grey" data-activates="menu"> 
 
     <div class="tap-target-content white-text open-content"> 
 
      <h5>I am here</h5> 
 
      <p class="white-text">Provide value and encourage return visits by introducing users to new features and functionality at contextually relevant moments.</p> 
 
     </div> 
 
    </div><div class="tap-target-wave open-btn" ><a class="btn btn-floating btn-large red tap-target-origin"><i class="material-icons">plus_one</i></a></div></div> 
 
</div> 
 
</main> 
 

 

 
<script type="text/javascript" src="js/main"></script> 
 
</body> 
 
</html>

答えて

1

わからない他のアイコンはのUIに保管されている理由。しかし、このコードは編集ボタンを適所に維持するように機能します。

<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="UTF-8"> 
 
    <title>CMS</title> 
 
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> 
 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css"> 
 
    <link type="text/css" rel="stylesheet" href="css/style.css"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 
 
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.js"></script> 
 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script> 
 
</head> 
 
<body> 
 
<!-- navigatie --> 
 
<nav class="nav-extended"> 
 
    <div class="nav-wrapper"> 
 
     <a href="#" class="brand-logo ">CMS</a> 
 
     <ul id="nav-mobile" class="right hide-on-med-and-down"> 
 
      <li><a><i class="material-icons">settings</i></a></li> 
 
      <li><a><i class="material-icons">close</i></a></li> 
 
     </ul> 
 
    </div> 
 
    <div class="nav-content" id="tab_menu"> 
 
     <ul class="tabs tabs-transparent"> 
 
      <li class="tab"><a class="active" href="#test1">Statics</a></li> 
 
      <li class="tab"><a href="#test2">Edit</a></li> 
 
     </ul> 
 
    </div> 
 
</nav> 
 
<main> 
 
    <div id="test1" class="col s12"> 
 
</div> 
 
<div id="test2" class="col s12"> 
 
    <div class="row"> 
 
    <div class="col s12 m3"> 
 
     <div class="card"> 
 
      <div class="card-image"> 
 
       <img src="https://static1.squarespace.com/static/54bff0d3e4b03c2b708fee78/54dce804e4b0208bec0e6939/5554fca4e4b01c8cda5a5d55/1499833385964/log+cabin+exterior.jpg"> 
 
       <span class="card-title">Card Title</span> 
 
       
 
      </div> 
 
<div class="card-action" style="padding:0px"> 
 
       
 
      
 
<div class="fixed-action-btn horizontal" style="position:relative; float:right; bottom:35px; right:10px"> 
 
    <a class="btn-floating btn-large red"> 
 
     <i class="large material-icons">mode_edit</i> 
 
    </a> 
 
    <ul> 
 
     <li><a class="btn-floating red"><i class="material-icons">insert_chart</i></a></li> 
 
     <li><a class="btn-floating yellow darken-1"><i class="material-icons">format_quote</i></a></li> 
 
     <li><a class="btn-floating green"><i class="material-icons">publish</i></a></li> 
 
     <li><a class="btn-floating blue"><i class="material-icons">attach_file</i></a></li> 
 
    </ul> 
 
    </div> 
 
</div> 
 
      <div class="card-content"> 
 
       <p>I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively.</p> 
 
      </div> 
 
     </div> 
 
    </div> 
 
</div> 
 
    <div class="fixed-action-btn" onclick="$('.tap-target').tapTarget('open');" > 
 
     <a id="menu" class="btn btn-floating btn-large red"><i class="material-icons">plus_one</i></a> 
 
    </div> 
 
    <div class="tap-target-wrapper circle-open "><div class="tap-target grey" data-activates="menu"> 
 
     <div class="tap-target-content white-text open-content"> 
 
      <h5>I am here</h5> 
 
      <p class="white-text">Provide value and encourage return visits by introducing users to new features and functionality at contextually relevant moments.</p> 
 
     </div> 
 
    </div><div class="tap-target-wave open-btn" ><a class="btn btn-floating btn-large red tap-target-origin"><i class="material-icons">plus_one</i></a></div></div> 
 
</div> 
 
</main> 
 

 

 
<script type="text/javascript" src="js/main"></script> 
 
</body> 
 
</html>

+0

はいが、問題はこのように特定のデザインでオブジェクトを開くことはできないということです。 http://materializecss.com/buttons.html Horizo​​ntal FABにスクロールしてアイコンにカーソルを合わせると、それは私が探しているアクションデザインです。このようなことはできません。 –

+0

はインラインスタイルで回答を編集しました。それがあなたのために働くかどうか見てください。既存のスタイルでアラインメントを破る –

+1

はい、これは私のためでした。ありがとうございました! –

関連する問題