Professional Web Applications Themes

make div fit its contents - HTML & CSS

Greetings, I am using PHP to dynamically display information on a webpage. The information being displayed is placed inside its own div. I cannot set a width on these div's because the information that fills them isn't always the same length string. Sometimes the information could be one word or 20 words. I want the div's to automatically fit the length of the information inside of them, not stretch to 100% width. My question is: How do I setup the div's so that they will automatically resize to fit the information inside of them? Thank you for your time...

  1. #1

    Default make div fit its contents

    Greetings,

    I am using PHP to dynamically display information on a webpage. The information being displayed is placed inside its own div. I cannot set a width on these div's because the information that fills them isn't always the same length string. Sometimes the information could be one word or 20 words. I want the div's to automatically fit the length of the information inside of them, not stretch to 100% width.

    My question is:

    How do I setup the div's so that they will automatically resize to fit the information inside of them?

    Thank you for your time
    trytertqwr is offline Banned
    Join Date
    Aug 2011
    Posts
    23

  2. #2

    Default Re: make div fit its contents

    Do not set any width on the div. If a div has no width parameter in CSS, it will automatically re-size to fit the contents.
    Ravish is offline S U P E R U S E R
    Join Date
    Aug 2006
    Location
    Internet
    Posts
    21

  3. #3

    Default Re: make div fit its contents

    Just to add to what Ravish said, if you have the need to set a minimum in this case simply use 'min-width:' but don't put any other width parameters.
    Jim Eisenhauer is offline Junior Member
    Join Date
    Aug 2011
    Posts
    4

  4. #4

    Default Re: make div fit its contents

    For that set width of DIV is 100%. by this it is fit in the whatever it get the size and fit it with 100% width respect to other element
    Get The Low Price SSL Certificate From TheSSLstore.com, Update With New Offers and Disccounts
    thesslstore is offline Junior Member
    Join Date
    Apr 2011
    Location
    146, Second Street North, Suite 204 St. Petersburg
    Posts
    2

  5. #5

    Default Re: make div fit its contents

    Div tag is supported for Search engine optimization to boost up keyword rank ratings.
    [url]http://cmflyashbricks.com[/url]
    [url]http://bentfurn.com[/url]
    [url]http://dolphinswimmingacademy.com[/url]
    smithraj is offline Junior Member
    Join Date
    Dec 2012
    Location
    chennai
    Posts
    3

  6. #6

    Default Re: make div fit its contents

    http://klinikpembesar.com/

    http://pembesaralatvital.besaba.com/

    http://duniaobatkuat.blog.com/

    http://agenfruitplant.blog.com/

    http://vimaxherbal.blog.com/

    http://vigrxplusherbal.blog.com/
    Sherly Ayundia is offline Junior Member
    Join Date
    Jul 2014
    Posts
    4

Similar Threads

  1. i really wana make flash which prog do i download? andhow do i make it?
    By bob dole rules!!!!! in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: January 14th, 07:26 PM
  2. Listing contents of a directory folder to contents ofdirectory
    By Rubex_Cube in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: April 11th, 10:23 PM
  3. Open file, make changes, save file, close, re-open, file contents not changed
    By brock@bergdesign.com in forum Adobe Illustrator Macintosh
    Replies: 7
    Last Post: March 7th, 07:29 PM
  4. Replies: 1
    Last Post: January 27th, 05:13 AM
  5. GNU make & make.pl are dead: long live Perl makepp
    By Daniel Pfeiffer in forum PERL Miscellaneous
    Replies: 1
    Last Post: September 9th, 07:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139