File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to move Background image on resize of window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to move Background image on resize of window " Watch "How to move Background image on resize of window " New topic
Author

How to move Background image on resize of window

Sapan Shah
Greenhorn

Joined: Jan 01, 2010
Posts: 25
I am displaying a background image on a new window having size width=1200,height=600.
On that image i am displaying the data (for eg its length,width,Length Width ratio etc) around the image using java code.
Problem is that when i maximize the window,or reduce the size below 1200x600 the value moves,but the image remains still of size(420x216).
And the image is inside a table

<table width="100%" border="1">
<table width="490" height="220" border="0">
<image>Here is the image i am using</image>
</table>
</table>

Below is the Css i am using

background-image: url("../images/TS1.jpg");
background-repeat: no-repeat;
background-position: 0px 3px;
margin: 0px;
padding: 0px;
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

I'm not understanding what the issue is. What do you expect to happen that's not happening?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sapan Shah
Greenhorn

Joined: Jan 01, 2010
Posts: 25
When i resize the window ie maximizing or decreasing the size of the window, the table size also vary according to the size of the window.

What happen : when i decrease the size of the window suppose towards the left,the value also goes to the left but the background image doesn't vary its size.
I excect : what i expect is that image should also resize.

Below is the example.

4.25 is the value and (------) is the image.

<---4.25--->
-------------

After decreasing the size of the window(  is a blank space please ignore it)

<---4.25---> (Value goes towards left side)
 ------------ (But image remains still it doen't compress)
Sapan Shah
Greenhorn

Joined: Jan 01, 2010
Posts: 25
When i resize the window ie maximizing or decreasing the size of the window, the table size also vary according to the size of the window.

What happen : when i decrease the size of the window suppose towards the left,the value also goes to the left but the background image doesn't vary its size.
I excect : what i expect is that image should also resize.

Below is the example.

4.25 is the value and (------) is the image.

<---4.25--->
-------------

After decreasing the size of the window((blank space); is a blank space please ignore it)

<---4.25---> (Value goes towards left side)
(blank space)------------ (But image remains still it doen't compress)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure why you'd expect the image to change sizes--if you browse the web you'll see this only very rarely.

In any case, you'll have to write some JavaScript, or figure out if that's possible using just CSS (my guess is no, but I've never tried).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to move Background image on resize of window
 
Similar Threads
problems with rich:scrollabledatatable headers
Background image in different resolution
css specificity for textfield
Default style for textfield
Safari and IE issues.