LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2006, 02:29 PM   #1
trainpic
Member
 
Registered: Apr 2004
Location: Ohio
Distribution: Ubuntu 6.06 LTS (Ubuntu, Edubuntu, Ubuntu Server)
Posts: 77
Blog Entries: 2

Rep: Reputation: 15
Add pixel values and percentages in CSS


Is their any way to specify a dimension (margin, top, left, etc.) in CSS usign both a pixel value and a percentage, something like "70% + 50px", This woudl be very useful in my three-column layout.
 
Old 06-30-2006, 08:03 AM   #2
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
Eh .. are you sure you need it? I recommend you re-think the sizes a bit. I don't think you can do that. Also, avoid using absolute values. Try to keep your website "100% resizeable".
 
Old 06-30-2006, 10:11 AM   #3
Spudley
Member
 
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
Quote:
Originally Posted by introuble
Eh .. are you sure you need it? I recommend you re-think the sizes a bit. I don't think you can do that. Also, avoid using absolute values. Try to keep your website "100% resizeable".
Yes, there are times when this would be very useful. I've been doing a lot of CSS, and after cross-browser issues, this is one of the biggest problems I've had.

It would be useful to do this where you're trying to get graphics (which aren't resizable) into your page so that they don't mess up the layout when you resize the page.

It would also be nice to be able to specify a percentage and then subtract a number of pixels; without this, you can never use 100% of your area, because you have to compensate for a margin or border (which are in pixels, and therefore mess up a percentage-based layout)


To answer the original question: no, as you've found, you can't do this directly. But if you're trying to make a column-based layout as you describe, you depending on the result you're trying to achieve, you might be able to get what you want using margins and padding (or even borders, at a push) --
eg width:70%; padding-left:25px; padding-right:25px;

Margins and padding do similar things, but work subtly differently, so try them both, and combinations of them, and see what works.

Hope that helps
 
Old 06-30-2006, 10:41 AM   #4
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
It seems to me this is just trying to take a short cut. Or find a quick method of implementing an idea when you could try and search for a diff. idea.

I *too* have written quite a lot of CSS. I've created enough sites using vim [and not just the "text-only" kind] that I can write XHTML 1.0 Strict / CSS 2.0 directly [validation is just a formality].

All I'm saying is .. I've never had this problem .. but sure .. why not ..

Good luck with finding a fix.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pixel pipelines? tnelson42345 Linux - Hardware 1 11-12-2005 12:25 PM
/proc/stat values don't add up ! mike0w Linux - General 0 10-25-2005 05:01 AM
Add CSS to Apache Autoindexes? dbc001 Linux - Networking 0 12-11-2004 12:38 PM
useradd and modifying style.css and index.html to add new user's name kelticfury Linux - General 2 05-22-2004 09:21 AM
Add values using awk Helene Programming 4 04-21-2004 06:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration