ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Auto resize width of floating DIV to fit contain using CSS<p>Apply <strong>display: inline-block;</strong></p> <p>Try by below code.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;div style=&#34;color: gray; font-size: 11px; border: 1px solid lightgray; border-right: 1px solid lightgray; border-left: 1px solid lightgray; padding: 5px; display: inline-block;&#34;&gt; &lt;h4&gt;Time(12:01:49 PM)&lt;/h4&gt; Above is test text for time&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/199407/Auto-resize-width-of-floating-DIV-to-fit-contain-using-CSS/https://www.aspforums.net:443/Threads/199407/Auto-resize-width-of-floating-DIV-to-fit-contain-using-CSS/Tue, 06 Feb 2018 01:10:43 GMTAuto resize width of floating DIV to fit contain using CSS<p>Just change the display property as <strong>display: table;</strong> to work fine when using float property. Try by this and implement as per your logic.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;div style=&#34;color: black; float: right; clear: right; margin-right: 10px; margin-top: 5px; margin-bottom: 5px; font-size: 20px; font-family: calibri; background-color: white; border: 1px solid lightgray; padding: 5px; border-radius: 5px; word-wrap: break-word; display: table;&#34;&gt; &lt;p style=&#34;font-weight: bold; padding: 0; margin: 0&#34;&gt; ann &lt;/p&gt; Hi test message to check the chat messages &lt;/div&gt; &lt;div style=&#34;color: black; clear: right; margin-left: 10px; margin-top: 5px; margin-bottom: 5px; font-size: 20px; font-family: calibri; background-color: white; border: 1px solid lightgray; padding: 5px; border-radius: 5px; word-wrap: break-word; display: table;&#34;&gt; &lt;p style=&#34;font-weight: bold; padding: 0; margin: 0&#34;&gt; Anvina &lt;/p&gt; hi recieved message to check the chat messages &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/199407/Auto-resize-width-of-floating-DIV-to-fit-contain-using-CSS/https://www.aspforums.net:443/Threads/199407/Auto-resize-width-of-floating-DIV-to-fit-contain-using-CSS/Tue, 06 Feb 2018 01:50:06 GMT