473,219 Members | 1,906 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,219 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 31640
"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...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.