Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-17-2012, 01:55 AM   PM User | #1
RKic
New Coder

 
Join Date: Feb 2012
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
RKic is an unknown quantity at this point
% sized div boxes and graphics

Ladies and gentlemen. For my next stupid question....


I set up my site with a somewhat liquid layout and my nav and content divs have a percentage width. I have some images inside these boxes (nav buttons and such) but they don't shrink along with their container when I resize the page. Instead the right border of the container box "eats" the images as it approaches them.
RKic is offline   Reply With Quote
Old 02-17-2012, 02:34 AM   PM User | #2
Arbitrator
Senior Coder

 
Arbitrator's Avatar
 
Join Date: Mar 2006
Location: Splendora, Texas, United States of America
Posts: 2,906
Thanks: 5
Thanked 191 Times in 188 Posts
Arbitrator is on a distinguished road
Quote:
Originally Posted by RKic View Post
For my next stupid question....
So, uh, what was the question?
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *
Arbitrator is offline   Reply With Quote
Old 02-17-2012, 06:00 AM   PM User | #3
JustS
New to the CF scene

 
Join Date: Feb 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
JustS is an unknown quantity at this point
Quote:
Originally Posted by RKic View Post
Ladies and gentlemen. For my next stupid question....


I set up my site with a somewhat liquid layout and my nav and content divs have a percentage width. I have some images inside these boxes (nav buttons and such) but they don't shrink along with their container when I resize the page. Instead the right border of the container box "eats" the images as it approaches them.
Found out the hard way that, in a Blogger post, %ages were eliminated. I started using em instead.
http://www.w3schools.com/cssref/css_units.asp

I don't know if this'll help or not, but it's the thought that counts, right?
JustS is offline   Reply With Quote
Old 02-17-2012, 10:36 PM   PM User | #4
RKic
New Coder

 
Join Date: Feb 2012
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
RKic is an unknown quantity at this point
Quote:
Originally Posted by Arbitrator View Post
So, uh, what was the question?
So uh, why is it doing that? the coding for the images and buttons is all nested within the NAV div. Shouldn't everything within it automatically be affected by its own size?
RKic is offline   Reply With Quote
Old 02-17-2012, 10:42 PM   PM User | #5
Kevin_M_Schafer
Regular Coder

 
Kevin_M_Schafer's Avatar
 
Join Date: Apr 2011
Location: Fairfax, Minnesota, U.S.A.
Posts: 482
Thanks: 97
Thanked 17 Times in 17 Posts
Kevin_M_Schafer is an unknown quantity at this point
RKic,

Images cannot simply resize along with the fluid layout of css and html. They need help with either javascript or perhaps media queries for a responsive web design approach. I may be wrong, and if another coder steps in and says, please listen to them.

--Kevin

.
__________________
My keyboard is an IBM from 1993 and I like it that way. | Who is Dan Well? Everyone always says I know Dan Well.Building a web page is like building a birdhouse. Put it up there and watch 'em come. | Maintaining the aspect ratio of an image is more important than having a cold orange pop.
Kevin_M_Schafer is offline   Reply With Quote
Old 02-18-2012, 01:16 AM   PM User | #6
waxdoc
Regular Coder

 
Join Date: Jul 2008
Posts: 155
Thanks: 9
Thanked 13 Times in 13 Posts
waxdoc is an unknown quantity at this point
my experiments

I've been experimenting with liquid layouts and percentage widths at http://www.gerigeans.com http://auntnini.webs.com and http://oksenhendler.webs.com/

If I understand the question correctly, you need to also set up width: 90%; min-width: 100px; max-width: 500px; for the images and containers.

such as
Code:
#wrap { color: #090909; margin: 20px auto; padding: 20px; width: 85%; max-width:1000px; min-width: 50px;  position: relative;   background-color: rgba(255, 255,255, 0.25);  z-index:300; }
#wrap img {  height: auto; width: 85%; max-width: 800px; min-width: 20px; }
Not sure if percentage % is right approach

Last edited by waxdoc; 02-18-2012 at 01:19 AM.. Reason: corrected URLs
waxdoc is offline   Reply With Quote
Old 02-21-2012, 11:21 PM   PM User | #7
RKic
New Coder

 
Join Date: Feb 2012
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
RKic is an unknown quantity at this point
Quote:
Originally Posted by waxdoc View Post
I've been experimenting with liquid layouts and percentage widths at http://www.gerigeans.com http://auntnini.webs.com and http://oksenhendler.webs.com/

If I understand the question correctly, you need to also set up width: 90%; min-width: 100px; max-width: 500px; for the images and containers.

such as
Code:
#wrap { color: #090909; margin: 20px auto; padding: 20px; width: 85%; max-width:1000px; min-width: 50px;  position: relative;   background-color: rgba(255, 255,255, 0.25);  z-index:300; }
#wrap img {  height: auto; width: 85%; max-width: 800px; min-width: 20px; }
Not sure if percentage % is right approach
Ok, I think I see what you did there. I got that to work for a graphic which I have inserted into the nav bar, but when I apply the same style rules to the nav buttons, they simply vanish!
RKic is offline   Reply With Quote
Old 03-20-2012, 01:24 AM   PM User | #8
waxdoc
Regular Coder

 
Join Date: Jul 2008
Posts: 155
Thanks: 9
Thanked 13 Times in 13 Posts
waxdoc is an unknown quantity at this point
liquid layout

As JustS stated above, use em measurement (which is based on M letter of base font size) for text and nav-buttons.

My examples are in a fluid layout so the nav-buttons (which are float: left) just plop down one below the other. Might not be elegant, but did not want to reduce the navigation text.
waxdoc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:22 AM.


Advertisement
Log in to turn off these ads.