Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
How do I style the elements inside the twitter iframe widget?

So I am working on a website. I have included a twitter timeline in the HTML you can check how it is done here. I have inspected the widgets elements in the developer options, and it seems like an iframe element containing another html document inside my div(.cust-twitter-div) element from what I know.

Developer Options Screenshot

The problem is that I would like to further style the elements inside the widget and have tried the following solutions which have not seems to work.

  1. Using the default class name of the elements in a stylesheet using !important in each style. The only CSS selector that seem to work is the one below (note the iframe is included in the selector and cust-twitter-div is my div enclosing the widget):
.cust-twitter-div iframe {
   width: 90% !important;
   max-width: 600px !important;
   box-shadow: 00px 0px 10px #ffbc50b6;
}
  1. (The most puzzling one as to why it's not working) Selecting (again using their default class names) the elements using JS and adding the styles.
    document.onreadystatechange = function () {
      if (document.readyState == "complete") {
        console.log("DOM fully loaded and parsed");
        let cust_twitterElement = document.querySelector('.timeline-Body');
        console.log(cust_twitterElement);
      }
    }

Now, the puzzling thing about the second solution is that it returns null for the element I have selected. When I tried selecting the iframe it returned some sort of JS object/HTML element. Though in the inspector, it shows the iframe element has children, I cannot select them using JS as the returned object shows firstChild as null and children length as 0. As below:

Returned Object screenshot Returned Object screenshot

I ultimately concluded the iframe is the only element I could interact with in code both JS and CSS, but not the children the inspector shows it to be containing.

So what am I doing wrong? How can I get to style the elements inside the widget?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda