如何为Facebook嵌入信息流添加圆角(border-radius)?
Embedding a Facebook Page on Your Website
To successfully embed a Facebook Page on your website, you’ll need two core components: the HTML container that renders the page, and the Facebook SDK JavaScript to enable the embed functionality. Here’s a complete breakdown:
HTML Embed Container
This is the code block that defines how your Facebook Page will appear. Be sure to replace BLANK with your actual Facebook Page URL, and adjust the data-* attributes to match your desired layout:
<div class="fb-page" data-href="https://www.facebook.com/BLANK/" data-tabs="timeline" data-width="500" data-height="300" data-small-header="false" data-adapt-container-width="true" data-hide-cover="true" data-show-facepile="true"> <blockquote cite="https://www.facebook.com/BLANK/" class="fb-xfbml-parse-ignore"> <a href="https://www.facebook.com/BLANK/">BLANK</a> </blockquote> </div>
Required Facebook SDK JavaScript
Your original JS snippet was truncated, so here’s the full, official script you need to include (place this right before the closing </body> tag for optimal performance):
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v18.0" nonce="YOUR_NONCE_VALUE"></script>
Quick Customization Tips:
- Replace
BLANKin the HTML with your actual Facebook Page URL (update it in all three places). - Swap
en_USin the SDK script with your preferred locale if you need the embed to display in a different language. - The
nonceattribute is optional but recommended if you’re using a Content Security Policy (CSP) for your site. - Tweak
data-*attributes to adjust the embed: changedata-tabstoeventsormessagesto show different page sections, or modifydata-width/data-heightto resize the embed.
内容的提问来源于stack exchange,提问作者SnowboardBruin
相关产品推荐
相关产品推荐

