Solved

3 elements composition for smaller resolutions

Posted on 2010-11-30
7
360 Views
Last Modified: 2012-05-10

Hi all,

The code below is a web page with 3 elements:
on the left: a soccer goal + ball image
center: a video
on the right: an image of a mobile phone

Viewing the whole thing in a resolution like mine 1440 x 900 there's no problem, all shows ok.
But when you use a less wide resolution (or you re-size the navigator window to less width), the mobile phone image goes behind the video (or the video on top of it).

What I am trying to get when in a smaller resolution (or when re-sizing to less width the navigator window) is the goal+ball image to stay where it is, and the mobile phone image to get closer to the video. But  as soon as there's no room for the 3 elements to show, it is the image of the mobile phone the one that has to get cut.

How can achieve this?? Please give me a hand with it, it's been many hours and I'm going nuts.

PD: attached myfolder.zip with the images, please rename

Thanks a lot myfolder.txt
<head> 

<style type="text/css"> 
#navigation {
}
 
#navigation ul, #navigation ul li {
	list-style: none;
	margin: 0;
	padding: 0;
}

 
#navigation ul {
	padding: 5px 15px; 
	text-align: left;
}
 
#navigation ul li {
	display: inline;

	margin-right: 0px;
	padding-top:10px;
}
 
#navigation ul li a div {
	background: url("myfolder/boton_ROLLOUT_08.png") no-repeat;

	padding: 10px 0.5em;
	
	color: #FFFFFF;
	text-decoration: none;
	font-size:12px;
}

#navigation ul li a div:hover {
	background: url("myfolder/boton_ROLLOVER_08.png") no-repeat;

	padding: 10px 0.5em;
	
	color:#FFFFFF;
	text-decoration: none;
	font-size:12px;
}     
</style>

</head> 
 
<body style="background-color:#E7E7E7;font-family: Arial, Helvetica, sans-serif;"> 

<div style="z-index:-1;position:absolute;left:0;top:30%;height:50%;width:100%;float:none">

	<div style="position:absolute;top:100px;left:0px;"><img src="myfolder/goal.jpg"></div>
		<div style="position:absolute;top:-90px;right:0px"><img src="myfolder/sonyx10_06.jpg"></div>

</div>


<div style="position:absolute;top:15%;left:20%">
 <div id="navigation" style="z-index:1;position:relative;top:-18px;left:0px"> 
	<ul> 
		<li><a href="#" id="t1" style="color:#FFFFFF;text-decoration:none;" ><div id="t1" style="float:left;width:140px;text-align:center;">tab1&nbsp;&nbsp;</div></a></li> 
		<li><a href="#" id="t2" style="color:#FFFFFF;text-decoration:none;"><div id="t2" style="float:left;width:140px;text-align:center">tab2&nbsp;</div></a></li> 
		<li><a href="#" id="t3" style="color:#FFFFFF;text-decoration:none;"><div id="t3" style="float:left;width:140px;text-align:center">tab3&nbsp;&nbsp;&nbsp;</div></a></li> 
	</ul> 

</div>

 <div id="video" style="z-index:50;text-align:left;float:left;width:726px;height:491px;padding:0px;margin-top:-20px">
 
 
			<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="710" height="480" id="index" align="middle"> 
				<param name="movie" value="http://elandroidelibre.movilgol.mobi/video.swf" /> 
				<param name="quality" value="high" /> 
				<param name="bgcolor" value="#ffffff" /> 
				<param name="play" value="true" /> 
				<param name="loop" value="true" /> 
				<param name="wmode" value="window" /> 
				<param name="scale" value="showall" /> 
				<param name="menu" value="true" /> 
				<param name="devicefont" value="false" /> 
				<param name="salign" value="" /> 
				<param name="allowScriptAccess" value="sameDomain" /> 
				<!--[if !IE]>--> 
				<object type="application/x-shockwave-flash" data="http://elandroidelibre.movilgol.mobi/video.swf" width="710" height="480"> 
					<param name="movie" value="http://elandroidelibre.movilgol.mobi/video.swf" /> 
					<param name="quality" value="high" /> 
					<param name="bgcolor" value="#ffffff" /> 
					<param name="play" value="true" /> 
					<param name="loop" value="true" /> 
					<param name="wmode" value="window" /> 
					<param name="scale" value="showall" /> 
					<param name="menu" value="true" /> 
					<param name="devicefont" value="false" /> 
					<param name="salign" value="" /> 
					<param name="allowScriptAccess" value="sameDomain" /> 
				<!--<![endif]--> 
					<a href="http://www.adobe.com/go/getflash"> 
						<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Adobe Flash Player" /> 
					</a> 
				<!--[if !IE]>--> 
				</object> 
				<!--<![endif]--> 
			</object> 
		

</div>

</div>


 
</body>

Open in new window

0
Comment
Question by:Dada44
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34238332
Floating behaviour on block-level elements make that, on resizing to a width lesser than the minimum enough to render all blocks, the rightmost elements begin dropping to next lines.

To avoid this type of behaviour you can do several things, depending on what effect you seek and how your view is displayed.

if what you want is your two first blocks (goal and video) to float, and the third to get cropped (this will
make appear a scrollbar on your page when there isn't enough width space for the three objects) you
need to enclose the two first elements on a div and the third one on another. None of such divs will float, while inside the first one, you'll enclose your first and second element on another divs wich will float one to another.

This is usually difficult to explain, let me know if you have problems understanding it.
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34238357
Mmmm.... I think that what I've described will make your video to jump below the goal image... you'll need to make no one of the three elements floats... but this can make your video to not render completely when window size reach too low dimensions...
0
 

Author Comment

by:Dada44
ID: 34238990
Hi, thanks a lot for answering.

Seems that the least resolution before all the elements go crazy is 1280x800.
Is there any way (via javascript maybe)  for the elements to stop resizing at that resolution and show the scroll bars instead?

Thanks again
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 19

Expert Comment

by:Bardobrave
ID: 34239601
Well... I supose it's possible to detect screen size through javascript and change style elements on divs upon reaching a certain resolution to avoid floating and resizing. However it's not an approach that sounds very pretty for my.

I'm not sure if there's any event attached to window resizing, but if there is any, you would be able to do what you are asking for.
0
 

Author Comment

by:Dada44
ID: 34239997
I'm trying adding to the body tag:
min-width:1280px;

No results, but I'm wondering if this is correctly used and if it could be a solution .. what do you think?
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 500 total points
ID: 34245745
I don't think so, min-width won't allow you to force the position of elements above window resize. You should modify the width and float styles through javascript.
0
 

Author Closing Comment

by:Dada44
ID: 34247129
thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Json Schema 8 32
Explain this javascript function to me 2 25
Button function on table is in trouble 3 20
Selected in an option list 13 20
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question