WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > CSS Beer Glass

Reply
  Thread Tools Display Modes
Old 23rd March 12, 04:22 PM   #1
BDenson
WLC Member
 
Join Date: Mar 2012
Posts: 2
Default CSS Beer Glass

I am trying to make a Beer Glass that fills up depending on a PHP variable.

Quite similar to this http://www.suenovotny.com/blog/2011/...ss-and-php.php except it will be vertical and not horizontal and the glass is not a regular shape like the oval on that demo.

I'm a php programmer not a designer so I'm not sure if its even possible.

can anyone give me any hints or point me towards a suitable tutorial?

Thanks

Baz
BDenson is offline   Reply With Quote
Old 23rd March 12, 04:34 PM   #2
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: CSS Beer Glass

use an image in the shape of a glass with the area of the glass set to transparent, and overlay it on two elements, one set to the % height of the empty colour, the other set to be the colour and % height of the fill.
chrishirst is offline   Reply With Quote
Old 24th March 12, 12:22 AM   #3
BDenson
WLC Member
 
Join Date: Mar 2012
Posts: 2
Default Re: CSS Beer Glass

Quote:
Originally Posted by chrishirst View Post
use an image in the shape of a glass with the area of the glass set to transparent, and overlay it on two elements, one set to the % height of the empty colour, the other set to be the colour and % height of the fill.
Thanks Chris.

I have tried the following:

Code:
#beerglass {
  height:350px; 
  width:30px; 
  border:1px solid #CCC;
  }
  
#beer {
  background-color:#FFCC00; 
  width:100%;
  }


<div id=beerglass>
  <div id=beer style=height:65%>
  </div>
</div>

No glass image yet obv but it fills from the top down, and I need to fill from the bottom up.
BDenson is offline   Reply With Quote
Old 24th March 12, 11:49 AM   #4
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: CSS Beer Glass

And you do that reducing the height of the "empty" block at each step so it "uncovers" more of the "full" block.

Simple maths and logic, something that is half full is also half empty.

If you understand how positioning works you can do the same kind of thing using relative positioning, and overlay various elements.
chrishirst is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

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. The time now is 04:39 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.