Jump to content
xisto Community
Sign in to follow this  
chocolatxbliss

Image Positioning...help?

Recommended Posts

You can use CSS to position an image like say a logo. you would first define the CSS like this with CSS<style type ="text/css"> <!-- img.logo {position:fixed; top:0px; right:0px} --></style>The above would go before the </head> of your page then you would place the style you just defined for the image tage with a class of logo like the below<img class="logo" src="where the image is">The above will set your logo image at the top right of your page and it would stay there even if the user scrolls down, I am sure you have seen this before.All you need to do now is go and learn about CSS or DHTML, just do a gGoogle search for positioning images or CSS positioning.

Share this post


Link to post
Share on other sites

Following houdini's little help i would also like to add that you could use absolute positioning too if you don't like CSS all that much (no offence =P).

 

For example:

<img src="[B]url of image here[/B]" style="position:absolute; left:[B]0[/B]px; top:[B]0[/B]px">

Where the bolded zeros are you would place the number of pixels from the page margins you want an image to be. For instance, if you had put in top:100px then the image will be a 100 pixels below the top margin and vice versa for the left margin. You could also substitute the left margin for the right margin if you want.

 

You also have to remember to set the margins for the page in order for this code to work right in Firefox or other Mozilla/Netscape browsers.

EX: In the body tag, add LEFTMARGIN="0" TOPMARGIN="0" within it. The numbers are of course changeable to whatever margins you wish the page to start with.

Share this post


Link to post
Share on other sites

Actually the code given above is CSS but it is inline with the tag instead of defining a class as I did you still are defining the CSS within the element itself so he would still be using CSS (That is what style is A Cascading Style Sheet) and it must be referenced.

 

You can use absolute , relative, fixed or static positioning. So he would still need to learn a little about CSS and how to use it for whatever his particular application. It is not that hard really, and DHTML is the Combination of CSS, JavaScript and HTML to achieve dynamic results that are just not possible with any of the above alone. A great site is Dynamic Drive with all knids of free code and hints as well as samples.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.