Go Back   CodingForums.com > :: Client side development > General web building > Building for mobile devices

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-02-2010, 03:31 PM   PM User | #1
john love
New Coder

 
Join Date: Mar 2007
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
john love is an unknown quantity at this point
Question @media selectors for the iPhone

My challenge is the proper use of @media selectors for just the iPhone, such as:

Code:
@media screen and (max-device-width:480px) and (orientation:portrait) {
#poemWrapper {
	text-align:     left;
	}
	
#poem {
	width:          auto;
	color:          #00f;     /* just for testing */
	}
}
This inline approach is not working for me.

I get a weak sister going with:

Code:
@media screen and (orientation:portrait)
but that will activate the iPad as well which is not what I want. I want to single out iPhone in the portrait orientation.

BTW, using only screen, versus just screen doesn't fix the problem.

HAALP!

John Love
john love is offline   Reply With Quote
Old 09-02-2010, 08:44 PM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,596
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Shouldn’t the max-device-width media query take care of that? Or is the AND operator not exclusive in CSS?
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 09-03-2010, 01:08 PM   PM User | #3
john love
New Coder

 
Join Date: Mar 2007
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
john love is an unknown quantity at this point
Your question is a good one. The sample code I've seen out there has the and boolean logic linking max-device-width and the orientation.

What is driving me nuts is that I do not own a smartphone and therefore I am forced to use the so-called emulators whose effectiveness I've come to doubt .. in short, do they accurately emulate??

In addition, these emulators do not handle re-direction.

Bottom line .. I guess I really don't know if:

@media only screen and (max-device-width:480px) and (orientationortrait)

bombs on a real mobile phone .. it definitely does on 2 so-called iPhone emulators.

Many, many folk testify that the above @media works, but I just cannot confirm it.

John Love
john love is offline   Reply With Quote
Old 09-03-2010, 07:29 PM   PM User | #4
Doctor_Varney
Regular Coder

 
Doctor_Varney's Avatar
 
Join Date: Mar 2008
Location: Midlands, UK
Posts: 649
Thanks: 45
Thanked 29 Times in 28 Posts
Doctor_Varney will become famous soon enough
I was told that scaled CSS layouts fit mobile phone screens. I don't know what you two are talking about. I've never seen or heard of those CSS rules before.


Would my scaled div layout work on a mobile phone? I don't use one but I suppose I could find someone who would let me borrow theirs.

I'm astounded that anyone would want to surf the internet on a mobile phone in the first place but I suppose it might be handy for some things.

Dr. V
__________________
Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

Last edited by Doctor_Varney; 09-03-2010 at 07:32 PM..
Doctor_Varney is offline   Reply With Quote
Old 09-03-2010, 10:07 PM   PM User | #5
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,596
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Dr. V, I’d suggest you read up on media queries. And maybe this helps you too, John. I suppose the emulators are emulating relatively close to reality but of course they are never a full replacement for a real device. But your very first media at-rule should address those devices that aren’t larger than the specified width. Maybe you can also work with the “resolution” query.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 09-04-2010, 01:23 AM   PM User | #6
Doctor_Varney
Regular Coder

 
Doctor_Varney's Avatar
 
Join Date: Mar 2008
Location: Midlands, UK
Posts: 649
Thanks: 45
Thanked 29 Times in 28 Posts
Doctor_Varney will become famous soon enough
Perhaps I should rephrase the question...

What sort of websites can't be seen on mobile phones?

Dr. V
__________________
Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

Last edited by Doctor_Varney; 09-04-2010 at 01:25 AM..
Doctor_Varney is offline   Reply With Quote
Old 09-09-2010, 12:54 PM   PM User | #7
john love
New Coder

 
Join Date: Mar 2007
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
john love is an unknown quantity at this point
I think??? I've got the iPhone licked, not because I've got an iPhone, but because I do have an iPad (which I love).

Anyway, to continue, I'm really having problems with Firefox recognizing the media css. As noted below, Safari does work properly, but Firefox doesn't seem to recognize the linked media css.

Let me please start from the beginning ...

I'm trying to center a poem, but if the window width gets too small, i.e. landscape -> portrait, I want the poem to (1) left align and (2) word-wrap. Here are the 2 .css files.

First, the default case:

Code:
/* css/default.css */

#header, #poemWrapper, #footer {
	text-align: center;
}

#poem {
	width:      28em;
}
Now, here iss the thin version of the .css:

Code:
/* css/thinMobile.css */

#header, #poemWrapper, #footer {
	text-align:    left;
}

#poem {
	width:         auto;
 /*
	color:         #00f;     // just for testing
 */
}
It successfully left aligns, but when the window width gets smaller than the width of the poem, there is zero word wrap in Firefox. Word wrap happens in Safari, SeaMonkey, but not in Firefox or Navigator 9. BTW, I know the Browser is accessing the thin version in Safari and SeaMonkey because of my color test -- but not Firefox nor Navigator.

I have read that Firefox does incorporate HTML 4, so does anyone have any ideas.

Here's the link.

Appreciate it.

John Love
john love is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 02:15 PM.


Advertisement
Log in to turn off these ads.