473,378 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how many px equal to 100% width?

mao
Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?
In other words,

<html>
....
<body>
....
</body>
</html>

In above html codes, my original CSS is
body {width: 100%;}

if I want my CSS use px unit, what is the X value in the following
code to have the same result as the one using width:100%?
body {width: Xpx;}

Dec 15 '07 #1
13 31915
"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g2000 prf.googlegroups.com...
Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?
In other words,

<html>
...
<body>
...
</body>
</html>

In above html codes, my original CSS is
body {width: 100%;}

if I want my CSS use px unit, what is the X value in the following
code to have the same result as the one using width:100%?
body {width: Xpx;}
There is no 1:1 ratio for converting from % to px. It depends on the
viewport size of your browser. It is different for different people,
depending on their screen resolution, whether their browser is maximised or
not, how much chrome/toolbars etc. there are in the browser and a whole
bunch of other things.

Dec 15 '07 #2
Nik Coughlin wrote:
"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g2000 prf.googlegroups.com...
<snip>
>if I want my CSS use px unit, what is the X value in the following
code to have the same result as the one using width:100%?
body {width: Xpx;}

There is no 1:1 ratio for converting from % to px. It depends on the
viewport size of your browser. It is different for different people,
depending on their screen resolution, whether their browser is maximised
or not, how much chrome/toolbars etc. there are in the browser and a
whole bunch of other things.
Agree. It is a "How many angels can dance on the head of a pin?" type
question. So as Jukka would bluntly say, "Stop wanting that".

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Dec 15 '07 #3
In article
<a4**********************************@i29g2000prf. googlegroups.co
m>,
mao <kc**********@gmail.comwrote:
Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?
In other words,

<html>
...
<body>
...
</body>
</html>

In above html codes, my original CSS is
body {width: 100%;}

if I want my CSS use px unit, what is the X value in the following
code to have the same result as the one using width:100%?
body {width: Xpx;}

If you do not put in a width on body or if you, unnecessarily,
put in a width of 100%, and if the body has a background colour
of red, the red will stretch as wide as the browser window. No
matter how wide the window.

But as you change the window size on even one screen, you
necessarily change the amount of red pixels. The pixels are a
fixed size and depend on the nature of the screen. The browser
window is variable and covers as many or as few pixels as you
have got.

Thus there is no px equivalence to a % in this matter.

--
dorayme
Dec 15 '07 #4
In article <33***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@centralva.netwrote:
Nik Coughlin wrote:
"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g2000 prf.googlegroups.com...

<snip>
if I want my CSS use px unit, what is the X value in the following
code to have the same result as the one using width:100%?
body {width: Xpx;}
There is no 1:1 ratio for converting from % to px. It depends on the
viewport size of your browser. It is different for different people,
depending on their screen resolution, whether their browser is maximised
or not, how much chrome/toolbars etc. there are in the browser and a
whole bunch of other things.

Agree. It is a "How many angels can dance on the head of a pin?" type
question.
I think of a "head of the pin" type question as rather more where
there is a feint chance of an answer in a debate with rather ill
defined terms.

But in this case there is no sense to the question itself. In the
former, it is not a matter of simple conceptual confusion but
rather a mistaken assessment of determinacy. In the case of
thinking that there is an equivalence between % and px, it is a
total misconception, the debate cannot even begin.

--
dorayme
Dec 15 '07 #5
rf

"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g2000 prf.googlegroups.com...
Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?
Fourty two.

--
Richard.
Dec 15 '07 #6
In article <XB*******************@news-server.bigpond.net.au>,
"rf" <rf@invalid.comwrote:
"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g2000 prf.googlegroups.com...
Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?

Fourty two.
That is brief prattle. I thought this was not allowed?

--
dorayme
Dec 15 '07 #7
rf wrote:
Fourty two.
Not everyone's cellphone is as tiny as mine.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Dec 15 '07 #8
dorayme wrote:
In article <XB*******************@news-server.bigpond.net.au>,
"rf" <rf@invalid.comwrote:
>"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g200 0prf.googlegroups.com...
>>Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?
Fourty two.

That is brief prattle. I thought this was not allowed?
I've heard of briefs by Pierre Cardin and Fruit of the Loom, but never
of brief Prattle. In any case, I'm sure that they are all allowed.

Dec 15 '07 #9
In article <Ra******************************@golden.net>,
Gus Richter <gu********@netscape.netwrote:
dorayme wrote:
In article <XB*******************@news-server.bigpond.net.au>,
"rf" <rf@invalid.comwrote:
"mao" <kc**********@gmail.comwrote in message
news:a4**********************************@i29g2000 prf.googlegroups.com...
Hi,

if I set my body element width to be 100%, how many px value equal to
this 100% width?
Fourty two.
That is brief prattle. I thought this was not allowed?

I've heard of briefs by Pierre Cardin and Fruit of the Loom, but never
of brief Prattle. In any case, I'm sure that they are all allowed.
I am sure they are. I momentarily forgot not to pull rf's chain,
there is something about an Australian that makes it hard to
resist. I do hope he does not take it the wrong way. He is VERY
sensitive where I am concerned. Actually his remark was quite
good and it has a particular pedigree:
http://en.wikipedia.org/wiki/Answer_...verse,_and_Eve
rything

<g>

--
dorayme
Dec 15 '07 #10
mao wrote:
>
if I set my body element width to be 100%, how many px value equal to
this 100% width?
All of them.
if I want my CSS use px unit
Why would you want to do that? px and % units don't usually mix well.

If you post a URL, or at least a mock up of what you envision, we could
evaluate the situation better and give you more specific advice.

--
Berg
Dec 15 '07 #11
dorayme wrote:
I think of a "head of the pin" type question as rather more where
there is a feint chance of an answer in a debate with rather ill
defined terms.
If that is the case, then we can have an answer of sorts. You create a
DIV (or anything else that can be set invisible) and style it to have
width:100%

This "thing" will be exactly the width in pixels that the OP is after.

So, they just have to use a bit of JavaScript, to find precisely how
wide it is (*right now*, it will be different one mouse click/drag
later) and the job is done.

As with the original "42", they're *really* not going to like the answer.

I've used this technique precisely once. I was using coloured DIVs to
generate simple horizontal bar charts, and on modern displays an
accuracy of one tenth of a percent of the display may be too coarse, so
I needed something finer, and pixels seemed the right thing to use.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Dec 16 '07 #12
In article <47********@news.greennet.net>,
Steve Swift <St***********@gmail.comwrote:
dorayme wrote:
I think of a "head of the pin" type question as rather more where
there is a feint chance of an answer in a debate with rather ill
defined terms.

If that is the case, then we can have an answer of sorts. You create a
DIV (or anything else that can be set invisible) and style it to have
width:100%
A div is 100% by default.

(I notice now I misspelt a word. Never mind. I suppose no one
really wants to talk about angels on pins? I think this business
might have started in reference to a needle point in a context
where many things might be able to be in the same place and yet
be distinguishably different. Angels!)

--
dorayme
Dec 16 '07 #13
On 12/14/07 09:23 pm, mao wrote:
>
if I set my body element width to be 100%, how many px value equal to
this 100% width?
body {width: Xpx;}
Why?
Perhaps if you explained why you would want to do such a thing, we could
give you useful advice.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Dec 17 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Emil Dotchevski | last post by:
I have a table that is at 100% width, which contains a <TD> that is 80% of that. In the <TD> I want to put pre-formatted text (the output from a C++ compiler, to be more precise) and I'd like the...
11
by: Not4u | last post by:
Hello, I have a problem with CSS code. I want to have one menu column with a fixed width and a 100% height and the rest of the page for content. ---------------- |.|.|<--100%-->|...
1
by: Anita Meyer | last post by:
Hello, I try to figure out, how I can define a div (using css) which is spread over the whole page. The example below is how I think it should work, but when using the Internet Explorer it...
4
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window...
0
by: Fred Lock | last post by:
The below tab menu derived from the earlier post display each tab sized according to its content, plus additional space by the 'width:100%;' causing the table to stretch the full width of the...
5
by: John Smith | last post by:
Here is my HTML table formatting code. <table border="1" width="100%"> <tr width = "100%"> <td width="33%">11asdhagdshaskgashjgahjgadhjgdjshdgasjdgajdgadjhgdgahjdgadhjsgad
50
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>...
11
by: yawnmoth | last post by:
How do you get both of these div's to have a 100% width? (1): <div style="float: left; background: black; color: white">Hello, world! </div> <div style="clear: both; background: blue; color:...
1
by: psion | last post by:
Hi, We have a gridview on a webpage, which we would like to be 100% of the table cell in which it is placed. When we specify the width to be 100%, this has no effect, but only if we specify a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.