title: How do I get the position of an element using Beautiful Soup?
body: <p>I have a fixed element in a HTML document and I need to get its position:</p>
  
  <p>What is the approach for it?</p>
  
  <p>I tried:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  
  markup = open("myFile.html")
  soup = BeautifulSoup(markup=markup.read(), features='html.parser')
  markup.close()
  
  spans = soup.find_all('span')
  for sp in spans:
      print(sp.get('style'))
  </code></pre>
  
  <p>And it returned <code>None</code></p>
  
  <p>The element:</p>
  
  <pre><code>&lt;span class="ocrx_word" id="word_1_304" title="bbox 1459 1183 1505 1205; x_wconf 77" contenteditable="true" style="font-family: sans-serif; position: fixed; left: 1459px; top: 1183px; width: 46px; height: 22px;"&gt;DC&lt;/span&gt;
  </code></pre>
  
  <p>Here the position:</p>
  
  <pre><code>element.style {
   font-family: sans-serif;
   position: fixed;
   left: 1459px;
   top: 1183px;
   width: 46px;
   height: 22px;
  }
  </code></pre>