Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
241 views
in Technique[技术] by (71.8m points)

html - Bootstrap is not applied to automatically generated cards via php

I am generating new cards with PHP code, but they do not listen to the grid of bootstrap 4. Raw html code works fine and displays them like they should be.

<div class="container-fluid padding">
  <div class="row padding">
    <?php foreach ($contacts as $contact): ?>
                <div class="col-sm-12 col-md-4">
                    <div class="card">
                    <?php echo '<img class="card-img-top" src="data:image/png;base64,'.base64_encode( $contact['horse_image'] ).'"/>'; ?>
                    <div class="card-body">
                        <h4 class="card-title"><?=$contact['horse_name']?></h4>
                        <p class="card-text"><?=$contact['short']?></p>
                    </div>
                    </div>
                </div>
            </div>
    <?php endforeach; ?>
  </div>
  <hr class="my-4">
</div>
question from:https://stackoverflow.com/questions/65849494/bootstrap-is-not-applied-to-automatically-generated-cards-via-php

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sorry, can't comment yet because of the reputation of 50 :D

In your foreach block is one closing div tag too much ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...