Webmaster Sun Login
Not a member yet? Sign up

please help me in setting height for div based on another div value

  • HOME
  • FORUMS
  • BLOGS
  • MARKETPLACE
  • ADVERTISING
  • SPECIAL OFFERS
  • WEB HOSTING
  • QUICK MENU
  • REGISTER HERE - Join us for FREE
Results 1 to 6 of 6
    Stick this thread
  1. #1
    Join Date
    May 2017
    Posts
    31
    Thumbs Up/Down
    Received: 2/0
    Given: 1/0
    Thanks
    5
    Thanked 2 Times in 2 Posts

    please help me in setting height for div based on another div value

    i have a div as below

    <div class="first" style="height:300px">
    <div class="subone"><img></img></div>
    <div class="subtwo">text</div>
    </div>

    main div height is 300px and the div inside it have a image which have variable height images. and i want the below div height to auto adjust based on the image div height.

    so all the main div "first" are looking equal height.

  2. #2
    Join Date
    May 2016
    Posts
    390
    Thumbs Up/Down
    Received: 47/0
    Given: 577/2
    Thanks
    34
    Thanked 32 Times in 31 Posts
    You wanted to have subtwo div same height with subone automatically?
    sorry I had to reask because I really don't understand your question.

  3. #3
    Join Date
    May 2017
    Posts
    31
    Thumbs Up/Down
    Received: 2/0
    Given: 1/0
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Marc van Leeuwen View Post
    You wanted to have subtwo div same height with subone automatically?
    sorry I had to reask because I really don't understand your question.
    Name:  2017-05-19_18-56-37.png
Views: 25
Size:  107.6 KB

    see the images i have uploaded and in that the images are equal in height so all the grid is equal in height.
    but if the image size increase or decreases than the grid size differ from other grids. so to maintain the grid, if the image size decrease that the below text area should auto adjust its height make it equal to others grids.

    also for image we can set max-height so the image size increases should not affect other grids...

    if you are not clear i will make some image and re explain you

  4. The Following User Says Thank You to godmadeus For This Useful Post:
    nesir (07-26-2017)

  5. #4
    Join Date
    May 2016
    Posts
    390
    Thumbs Up/Down
    Received: 47/0
    Given: 577/2
    Thanks
    34
    Thanked 32 Times in 31 Posts
    Quote Originally Posted by godmadeus View Post
    Name:  2017-05-19_18-56-37.png
Views: 25
Size:  107.6 KB

    see the images i have uploaded and in that the images are equal in height so all the grid is equal in height.
    but if the image size increase or decreases than the grid size differ from other grids. so to maintain the grid, if the image size decrease that the below text area should auto adjust its height make it equal to others grids.

    also for image we can set max-height so the image size increases should not affect other grids...

    if you are not clear i will make some image and re explain you
    I still can not understand what you wanted.

    can you explain on your design?

    You should explain directly on the design so I can understand and help you out.

    I know html and css, I will try to fix your issues.

  6. #5
    Join Date
    Jul 2017
    Location
    south africa
    Posts
    18
    Thumbs Up/Down
    Received: 3/0
    Given: 10/0
    Thanks
    7
    Thanked 1 Time in 1 Post
    If you have no heigh set for the "text div" at the bottom it will resize according to its parent div, that being said text does not resize in height and width like images , it breaks and will ad another line effectively lengthening your text if div, what you need is to use em value on your text instead of pixels. Text will usually overflow from divs , so trying the overflow hidden property may also help if maintain div but it will cut your text. Try em just set media queries for it when it gets too small .

  7. #6
    Join Date
    Jul 2014
    Posts
    256
    Thumbs Up/Down
    Received: 5/0
    Given: 0/0
    Thanks
    90
    Thanked 17 Times in 15 Posts
    try to add this in your css


    .subone {width: 100%;}
    .subone img{width: 95%; height: 200px;}

    it will force all your images inside subone class with 200px height.
    Affordable Website Themes
    https://www.20dollarthemes.com

Newer Threads

  1. sinu
    Antonio94
    Replies: 18 | Views: 934
    Last post by Antonio94, 06-16-2017, 08:04 AM
  2. Nickberr
    WildSpirit
    Replies: 15 | Views: 1683
    Last post by WildSpirit, 07-24-2017, 12:51 AM
  3. jayjain
    wms
    Replies: 6 | Views: 243
    Last post by wms, 05-19-2017, 09:12 AM

Older Threads

  1. HostXNow
    Marc van Leeuwen
    Replies: 5 | Views: 707
    Last post by Marc van Leeuwen, 05-19-2017, 02:03 AM
  2. Marc van Leeuwen
    Marc van Leeuwen
    Replies: 0 | Views: 234
    Last post by Marc van Leeuwen, 05-18-2017, 04:46 AM
  3. harrygreen90
    vicsylicious
    Replies: 16 | Views: 549
    Last post by vicsylicious, 09-04-2017, 05:08 AM
  4. donaldaxon
    AdrianneG
    Replies: 5 | Views: 353
    Last post by AdrianneG, 06-04-2017, 04:06 PM
  5. Marc van Leeuwen
    olaryeankarh
    Replies: 5 | Views: 349
    Last post by olaryeankarh, 08-08-2017, 07:01 AM

Latest Threads

  1. mildredtabitha
    Is shorttask legit?
    By mildredtabitha in forum Make Money Online
    Rob Whisonant
    Replies: 1 | Views: 29
    Last post by Rob Whisonant, Today, 07:46 PM
  2. 951Temec
    951Temec
    Replies: 0 | Views: 27
    Last post by 951Temec, Today, 05:06 AM
  3. 951Temec
    951Temec
    Replies: 0 | Views: 18
    Last post by 951Temec, Today, 04:56 AM
  4. Heather
    Heather
    Replies: 0 | Views: 28
    Last post by Heather, Yesterday, 09:16 PM
  5. beth24
    Rob Whisonant
    Replies: 2 | Views: 30
    Last post by Rob Whisonant, Today, 02:31 AM

Similar Threads

  1. mark
    jamesnader
    Replies: 1 | Views: 1678
    Last post by jamesnader, 12-10-2015, 10:08 AM
  2. Content by Rhonda
    Setting Goals for 2015
    By Content by Rhonda in forum Online Internet Marketing
    Content by Rhonda
    Replies: 0 | Views: 630
    Last post by Content by Rhonda, 02-19-2015, 02:17 PM
  3. Laviskajoermoy
    How may I enhance height
    By Laviskajoermoy in forum General Discussion
    Dating Expert
    Replies: 7 | Views: 2883
    Last post by Dating Expert, 02-16-2014, 09:45 PM
  4. Adrianne
    Adrianne
    Replies: 0 | Views: 1233
    Last post by Adrianne, 03-20-2013, 07:12 AM
  5. Jkit
    Jkit
    Replies: 0 | Views: 1072
    Last post by Jkit, 07-26-2012, 04:01 AM

Posting Permissions

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

Internet Marketing Forum

Webmaster Sun is a forum where you’ll find in-depth discussions and resources to help you succeed on the web whether you are new or experienced. You’ll find it all here. With topics ranging from internet marketing, search engine optimization, social networking, make money online, web hosting, affiliate marketing as well as hands-on technical support for web design, programming and more. We are a growing community of like-minded people that is keen to help and support each other with ambitions and online endeavors. Learn and grow, make friends and contacts for life.

Come Hang Out With Us

    Facebook Twitter Webmaster Forum Google+

    Webmaster Sun Logo
Copyright ©2012 - 2017, WebmasterSun.com. All rights reserved. Internet marketing forum for internet marketers, webmasters, web hosting providers, designers and affiliate marketers.

Welcome to Webmaster Sun

The World's Number 1 Webmaster Community, SEO and Marketplace

Log in!

Continue with Facebook
Continue With Email. By signing up you indicate that you have read and agree to the Terms of Service and Privacy Policy.

Sign in Manually

Need an account? Sign up now!