Can I change the width of the Like button comment box?

The Facebook β€œHow” button allows you to set the width of the button itself and the content associated with it (for example, the number of likes). However, I do not see any parameters in the documentation for controlling the width of the comment field that appears after clicking the "How" button:

https://skitch.com/troywarr/8d761/like-button-facebook-developers

Am I missing the opportunity for this, or is there no way to do this? I can override the width of the <iframe> that contains the comment field using CSS, but that does not change the width of the <iframe> content, so they overflow and crop. I also can’t change the style in the comments field because it is hosted in a different domain.


UPDATE:

Not sure why this question was interrupted - please comment if there is a problem with what I ask.

The content of the comment field is certainly not accessible using JavaScript or CSS. It is created in <iframe> , which excludes CSS styles from the parent document and is hosted on the Facebook domain, which prohibits cross-domain scripting:

https://skitch.com/troywarr/8d6wj/facebook-like-button

All I ask is:

  • Am I missing a parameter (documentary or not) that allows me to choose the width of this comment field?
  • If there is no setting, is there a tricky way to set the width of the comment field better than setting the width of its <iframe> via CSS?
+4
source share
1 answer

You can change anything if this is your site!

Use CSS and enforce the rule using an important directive

Inline CSS has the highest priority and then implemented than global ... etc.

Hope this helps.

Edit: you can customize the iframe from the outside via CSS. Example below

 #container iframe /* iframe is inside a element with ID="container" { width:200px !important; } 

The above will override the entire width if they were not specified with! important tag

+1
source

Source: https://habr.com/ru/post/1397893/


All Articles