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
    435
    Thumbs Up/Down
    Received: 52/0
    Given: 598/2
    Thanks
    34
    Thanked 38 Times in 37 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: 26
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
    435
    Thumbs Up/Down
    Received: 52/0
    Given: 598/2
    Thanks
    34
    Thanked 38 Times in 37 Posts
    Quote Originally Posted by godmadeus View Post
    Name:  2017-05-19_18-56-37.png
Views: 26
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
    33
    Thumbs Up/Down
    Received: 4/0
    Given: 10/0
    Thanks
    11
    Thanked 2 Times in 2 Posts
    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
    258
    Thumbs Up/Down
    Received: 5/0
    Given: 0/0
    Thanks
    92
    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: 1042
    Last post by Antonio94, 06-16-2017, 08:04 AM
  2. Nickberr
    WildSpirit
    Replies: 15 | Views: 1985
    Last post by WildSpirit, 07-24-2017, 12:51 AM
  3. jayjain
    wms
    Replies: 6 | Views: 282
    Last post by wms, 05-19-2017, 09:12 AM

Older Threads

  1. HostXNow
    Marc van Leeuwen
    Replies: 5 | Views: 831
    Last post by Marc van Leeuwen, 05-19-2017, 02:03 AM
  2. Marc van Leeuwen
    Marc van Leeuwen
    Replies: 0 | Views: 270
    Last post by Marc van Leeuwen, 05-18-2017, 04:46 AM
  3. harrygreen90
    trendjing
    Replies: 41 | Views: 1029
    Last post by trendjing, 11-19-2017, 02:41 PM
  4. donaldaxon
    AdrianneG
    Replies: 5 | Views: 420
    Last post by AdrianneG, 06-04-2017, 04:06 PM
  5. Marc van Leeuwen
    olaryeankarh
    Replies: 5 | Views: 403
    Last post by olaryeankarh, 08-08-2017, 07:01 AM

Latest Threads

  1. Rackie
    Rackie
    Replies: 0 | Views: 5
    Last post by Rackie, Today, 05:59 AM
  2. Sean Quinn
    Sean Quinn
    Replies: 2 | Views: 16
    Last post by Sean Quinn, Today, 03:55 AM
  3. haorion
    hello
    By haorion in forum New Member Introductions
    haorion
    Replies: 0 | Views: 4
    Last post by haorion, Today, 03:05 AM
  4. Carlos Kerika
    Tamlyn
    Replies: 1 | Views: 26
    Last post by Tamlyn, Yesterday, 07:50 PM
  5. mymelody28
    wms
    Replies: 3 | Views: 32
    Last post by wms, Today, 03:55 AM

Similar Threads

  1. mark
    jamesnader
    Replies: 1 | Views: 1731
    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: 686
    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: 2940
    Last post by Dating Expert, 02-16-2014, 09:45 PM
  4. Adrianne
    Adrianne
    Replies: 0 | Views: 1256
    Last post by Adrianne, 03-20-2013, 07:12 AM
  5. Jkit
    Jkit
    Replies: 0 | Views: 1096
    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!