16 replies [Last post]
bcyork
bcyork's picture
Offline
newbie
Chicago, IL
Last seen: 10 years 36 weeks ago
Chicago, IL
Timezone: GMT-5
Joined: 2008-06-02
Posts: 8
Points: 0

Is it possible to have a variable defined in the html page and called in an external css style page? I have
-----------html page --------------

@variables {
pageheight: 900px;
}

--------- css page -----------------
#left_container {
width: 375px;
height: var(pageheight)px;
float: left;
background-color: #c40b08;
position: absolute;
left: 0px;
top: 0px;
}

So the issue that i have is the page is divided into 2 columns. The left side red and the right white. The right side has the content is longer and the left side will always be shorter in used area. The red side needs to go to the bottom of each page always. If i just set it to what would need to be the max for all pages some they will be twice as long as necessary which i think looks bad. If the variable will work in the html page then i can set a length for each page. If the variable doesn't work in the html page is their anyway to accomplish what i need.

isedeasy
Offline
Enthusiast
Bristol
Last seen: 8 years 44 weeks ago
Bristol
Timezone: GMT+1
Joined: 2008-02-09
Posts: 74
Points: 12

Just use JavaScript to

Just use JavaScript to overwrite the CSS property...

"If a man is trying to hang himself from the tree in my yard but the knot keeps slipping and allowing him to fall before it kills him do you expect someone to go out and teach him to tie a better knot?" - Triumph

bcyork
bcyork's picture
Offline
newbie
Chicago, IL
Last seen: 10 years 36 weeks ago
Chicago, IL
Timezone: GMT-5
Joined: 2008-06-02
Posts: 8
Points: 0

can you explain ... i don't

can you explain ... i don't know java?

Triumph (not verified)
Anonymous's picture
Guru

bcyork wrote:can you explain

bcyork wrote:

can you explain ... i don't know java?

Javascript, not Java.

O'reilly makes some really comprehensive books on the subject.

bcyork
bcyork's picture
Offline
newbie
Chicago, IL
Last seen: 10 years 36 weeks ago
Chicago, IL
Timezone: GMT-5
Joined: 2008-06-02
Posts: 8
Points: 0

great for o'reilly ... that

great for o'reilly ... that doesn't really help

Triumph (not verified)
Anonymous's picture
Guru

bcyork wrote:great for

bcyork wrote:

great for o'reilly ... that doesn't really help

Hmm. They always help me. PHP is a better solution than javascript but why don't you just use faux columns instead of fooling around with variables in your css? That way you don't define the page height, you let the content do it.

bcyork
bcyork's picture
Offline
newbie
Chicago, IL
Last seen: 10 years 36 weeks ago
Chicago, IL
Timezone: GMT-5
Joined: 2008-06-02
Posts: 8
Points: 0

The content isn't long

The content isn't long enough on the left which is where the red is to define it by content. faux columns????

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 6 years 17 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

bcyork wrote:The content

bcyork wrote:

The content isn't long enough on the left which is where the red is to define it by content. faux columns????

Have you googled the phrase?????

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Triumph (not verified)
Anonymous's picture
Guru

Hugo wrote:bcyork wrote:The

Hugo wrote:
bcyork wrote:

The content isn't long enough on the left which is where the red is to define it by content. faux columns????

Have you googled the phrase?????

Hugo, Hugo, Hugo. Can't you see he want's you and I to do his work for him. He can't be bothered to read a book or google a phrase or look at a post called "Answer to 90% of the questions asked on this forum". Let's be realistic, ok?

Whups. Did I say that aloud? :blushing:

That was nice of me to provide the answer wasn't it? }:)

As you can see Sally, we don't spoon feed here. We'll point you in the right direction but then encourage you to find your own way so that you learn. Not only to be self sufficient but to be a real world problem solver. We'll guide you but we won't hold your hand. Not everyone's from chicago. :ohdear:

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 9 years 28 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Hmmm, faux columns alone

Hmmm, faux columns alone won't necessarily do the job unless the background is on the body. If the body is already used for another image, then the wrapper or whatever would need to be 100% high...

so after googling css "faux columns" you will also want css "100% height model" in order to do this correctly.

IE does support "css javascript" which is mostly used to shore up IE6's CSS failings. I would otherwise advise against using Javscript to size pages-- min and max height and width in CSS can usually do the job better and with less bloat.

Otherwise, unfortunately CSS does not support real variables (although some wildcards are supported)... sometimes I wonder if it will in the future. Presentation and behaviour can have a pretty blurry line.

I'm no expert, but I fake one on teh Internets

Triumph (not verified)
Anonymous's picture
Guru

Stomme poes wrote:Hmmm, faux

Stomme poes wrote:

Hmmm, faux columns alone won't necessarily do the job unless the background is on the body. If the body is already used for another image, then the wrapper or whatever would need to be 100% high...

so after googling css "faux columns" you will also want css "100% height model" in order to do this correctly.

If it's covered by a 100% height item then why can't it be on the body background? You're making it more complicated than it has to be.

Stomme poes wrote:

IE does support "css javascript" which is mostly used to shore up IE6's CSS failings. I would otherwise advise against using Javscript to size pages-- min and max height and width in CSS can usually do the job better and with less bloat.

Are you speaking of "expression" property?

Stomme poes wrote:

Otherwise, unfortunately CSS does not support real variables (although some wildcards are supported)... sometimes I wonder if it will in the future. Presentation and behaviour can have a pretty blurry line.

What are some good reasons for CSS to support variables?

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 30 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Triumph wrote:What are some

Triumph wrote:

What are some good reasons for CSS to support variables?

So you can easily change values like colours, fonts etc without having to search and replace.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Triumph (not verified)
Anonymous's picture
Guru

Tyssen wrote:So you can

Tyssen wrote:

So you can easily change values like colours, fonts etc without having to search and replace.

What about forcing a page height? Wink

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 30 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Yeah I know that's what the

Yeah I know that's what the thread is about, but my answer was in direct response to your question: being able to change colours and fonts would be especially useful for things like stylesheet switchers or for styling different sections of sites with a different theme.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Triumph (not verified)
Anonymous's picture
Guru

Tyssen wrote:Yeah I know

Tyssen wrote:

Yeah I know that's what the thread is about, but my answer was in direct response to your question: being able to change colours and fonts would be especially useful for things like stylesheet switchers or for styling different sections of sites with a different theme.

I know where you're coming from. Smile

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 9 years 28 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Quote:If it's covered by a

Quote:

If it's covered by a 100% height item then why can't it be on the body background? You're making it more complicated than it has to be.

It's only if the body is already holding a background image and that image couldn't be moved to another element : ) But I sure do overcomplicate things, which conflicts with my inherent laziness at times...

Quote:

Are you speaking of "expression" property?

Yup. I hate them but they've saved my butt quite a few times (mostly I'm a fan of flex-width pages).

Quote:

What are some good reasons for CSS to support variables?

Kinda what Tyssen said-- I'd love to be able to describe things more broadly, I'd love to be able to use regular expressions, I'd love to be able to reference a parent via its children, I'd like a pony for Christmas...

I'm no expert, but I fake one on teh Internets

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 30 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

A pony's for life, not just

A pony's for life, not just for Christmas. Wink

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference