Ezio Posted September 9, 2013 Share Posted September 9, 2013 How do you get the width and height of a webpage? I am manually trying to center an image on a webpage. I plan on getting the width and height of a webpage and setting the coordinates of the image to the width/2 and height/2. Link to comment Share on other sites More sharing options...
Don E Posted September 9, 2013 Share Posted September 9, 2013 (edited) Check out the Window object in JavaScript, innerHeight/innerWidth: http://www.w3schools.com/jsref/obj_window.asp Edited September 9, 2013 by Don E Link to comment Share on other sites More sharing options...
Ezio Posted September 9, 2013 Author Share Posted September 9, 2013 Thanks Link to comment Share on other sites More sharing options...
harpalsinh999 Posted September 9, 2013 Share Posted September 9, 2013 (edited) download fire bug install in firefox and open browser and open your webpage then right click of your image and firebug in right side display css code change the code and adjust your image and replace with your origenal css code Edited September 9, 2013 by harpalsinh999 Link to comment Share on other sites More sharing options...
davej Posted September 9, 2013 Share Posted September 9, 2013 (edited) I am manually trying to center an image on a webpage. I plan on getting the width and height of a webpage and setting the coordinates of the image to the width/2 and height/2. Unless you have an unusual or dynamic situation I think it is far more normal to just use css. Edited September 9, 2013 by davej 1 Link to comment Share on other sites More sharing options...
harpalsinh999 Posted September 10, 2013 Share Posted September 10, 2013 (edited) u define fixed them like fixed:width fixed:height Edited September 10, 2013 by harpalsinh999 Link to comment Share on other sites More sharing options...
Ezio Posted September 10, 2013 Author Share Posted September 10, 2013 Thank you guys for all your help. you guys are awesome. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now