Make facebook widget responsive

0

I have a div that is put news, and on the side of this div, has the facebook widget, wanted the size of it to be responsive, ie, the height of it was the same as the news div

My current html:

 <div class="row no-gutters">
    <div class="col-lg-8 col-md-12" id="noticias">
        <h3 class="">Ultimas Notícias</h3>
        <div class="card mb-2">
            <div class="row no-gutters">
                <div class="col-3"
                     style="background:url(<?php echo $noticias[0]['imagem'] ?>) center;background-size: cover !important"></div>
                <div class="col-9">
                    <div class="card-block mx-2 my-1">
                        <div class="card-title mb-1">
                            <div class="text-muted float-right"><?php echo date('d/m/Y', strtotime($noticias[0]['dataenvio'])) ?></div>
                            <div class="font-weight-bold"><?php echo $noticias[0]['titulo'] ?></div>
                        </div>
                        <div class="card-text ">
                            <?php echo $noticias[0]['mensagem'] ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card mb-2">
            <div class="row no-gutters">
                <div class="col-3"
                     style="background:url(<?php echo $noticias[1]['imagem'] ?>) center;background-size: cover !important"></div>
                <div class="col-9">
                    <div class="card-block mx-2 my-1">
                        <div class="card-title mb-1">
                            <div class="text-muted float-right"><?php echo date('d/m/Y', strtotime($noticias[1]['dataenvio'])) ?></div>
                            <div class="font-weight-bold"><?php echo $noticias[1]['titulo'] ?></div>
                        </div>
                        <div class="card-text ">
                            <?php echo $noticias[1]['mensagem'] ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card mb-2">
            <div class="row no-gutters">
                <div class="col-3"
                     style="background:url(<?php echo $noticias[2]['imagem'] ?>) center;background-size: cover !important"></div>
                <div class="col-9">
                    <div class="card-block mx-2 my-1">
                        <div class="card-title mb-1">
                            <div class="text-muted float-right"><?php echo date('d/m/Y', strtotime($noticias[2]['dataenvio'])) ?></div>
                            <div class="font-weight-bold"><?php echo $noticias[2]['titulo'] ?></div>
                        </div>
                        <div class="card-text ">
                            <?php echo $noticias[2]['mensagem'] ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class=" ml-2 col-lg-2 col-md-12">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = 'https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.12';
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));</script>
        <div class="fb-page" data-href="https://www.facebook.com/facebook" data-tabs="timeline" data-small-header="true" data-adapt-container-width="false" data-hide-cover="false" data-show-facepile="true"><blockquote cite="https://www.facebook.com/facebook" class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/facebook">Facebook</a></blockquote></div>    </div>
</div>

Result

    
asked by anonymous 22.03.2018 / 18:38

1 answer

0

Hello, Igor

I understood. I think it's basically the code structure, I think it used Bootstrap as a framework.

I created the new structure from Bootstrap, I commented in the code, you can delete it if you want, I replaced some columns, I ask you to look at the PHP code, because I may have let something escape and test this structure:

<div class="container-fluid">
<!-- Você pode alterar o container-fluid apenas para container -->
<div class="row no-gutters">
    <div class="col-md-10">
     <!-- Titulo Notícias -->
     <div  id="noticias" class="col-md-10">
        <h3> Ultimas Notícias </h3>
     </div>
     <!-- Início das notícias -->

     <!-- N0 -->
    <div class="card mb-2">
        <div class="row no-gutters">
            <!-- Imagem 
                col-3
            -->
            <div class="col-md-3"
                 style="background:url(<?php echo $noticias[0]['imagem'] ?>) center;background-size: cover !important"></div>
            <!-- Dados da Notícia
                col-9
             -->
            <div class="col-md-9">
                <div class="card-block mx-2 my-1">
                    <div class="card-title mb-1">
                        <div class="text-muted float-right"><?php echo date('d/m/Y', strtotime($noticias[0]['dataenvio'])) ?></div>
                        <div class="font-weight-bold"><?php echo $noticias[0]['titulo'] ?></div>
                    </div>
                    <div class="card-text ">
                        <?php echo $noticias[0]['mensagem'] ?>
                    </div>
                </div>
            </div>
            <!--FIM  Dados da Notícia -->
        </div>
    </div>

    <!-- N1 -->
    <div class="card mb-2">
        <div class="row no-gutters">
            <!-- Imagem 
                col-3
            -->
            <div class="col-md-3"
                 style="background:url(<?php echo $noticias[1]['imagem'] ?>) center;background-size: cover !important"></div>
            <!-- Dados da Notícia
                col-9
             -->
            <div class="col-md-9">
                <div class="card-block mx-2 my-1">
                    <div class="card-title mb-1">
                        <div class="text-muted float-right"><?php echo date('d/m/Y', strtotime($noticias[1]['dataenvio'])) ?></div>
                        <div class="font-weight-bold"><?php echo $noticias[1]['titulo'] ?></div>
                    </div>
                    <div class="card-text ">
                        <?php echo $noticias[1]['mensagem'] ?>
                    </div>
                </div>
            </div>
            <!--FIM  Dados da Notícia -->
        </div>
    </div>

    <!-- N2 -->
    <div class="card mb-2">
        <div class="row no-gutters">
            <!-- Imagem 
                col-3
            -->
            <div class="col-md-3"
                 style="background:url(<?php echo $noticias[2]['imagem'] ?>) center;background-size: cover !important"></div>
            <!-- Dados da Notícia
                col-9
             -->
            <div class="col-md-9">
                <div class="card-block mx-2 my-1">
                    <div class="card-title mb-1">
                        <div class="text-muted float-right"><?php echo date('d/m/Y', strtotime($noticias[2]['dataenvio'])) ?></div>
                        <div class="font-weight-bold"><?php echo $noticias[2]['titulo'] ?></div>
                    </div>
                    <div class="card-text ">
                        <?php echo $noticias[2]['mensagem'] ?>
                    </div>
                </div>
            </div>
            <!--FIM  Dados da Notícia -->
        </div>
    </div>
    </div>

    <!-- Segunda Coluna -->
    <div class="col-md-2">
        <!-- Facebook -->
        <div id="fb-root"></div>
        <script>
            (function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = 'https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.12';
                fjs.parentNode.insertBefore(js, fjs);}
                (document, 'script', 'facebook-jssdk'));
        </script>

        <div class="fb-page" data-href="https://www.facebook.com/facebook" data-tabs="timeline" data-small-header="true" data-adapt-container-width="false" data-hide-cover="false" data-show-facepile="true">
            <blockquote cite="https://www.facebook.com/facebook" class="fb-xfbml-parse-ignore">
                <a href="https://www.facebook.com/facebook">Facebook</a>
            </blockquote>
        </div>
    </div>
</div>

I tested and the structure was nice, but since I do not have php, I could not visualize the news.

    
27.03.2018 / 19:56