I use the setHtml() method of a setHtml() class. I want 2 blocks to draw next. For browsers the following code is googled:

 <div style="width:100%;"> <div style="float:left;">Content left div</div> <div style="float:right;">Content right div</div> </div> 

when drawn in Qt, the blocks are under each other. The documentation states that the float tag works only for tables and images.

How to place two <div> blocks side by side in Qt5 HTML?

  • Most likely - (by reasonable means) neither. Qt supports a very limited subset of html. - Fat-Zer pm
  • I don’t know anything about Qt, but for building blocks, IMHO, it’s best to use flexbox: html5.by/blog/flexbox If you can write any arbitrary style to the style attribute, do it through flexbox. - Dmitriy

1 answer 1

Add the width for the first block to 50%:

 <div style="width:100%;"> <div style="float:left; width: 50%">Content left div</div> <div style="float:right;">Content right div</div> </div> 
  • nothing has changed - magrif February