This is a discussion on "Setting a default image size using CSS?" within the Web Page Design section. This forum, and the thread "Setting a default image size using CSS? are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Setting a default image size using CSS?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Setting a default image size using CSS?
First off, I will say that I had a look for similar threads with such a topic and couldn't seem to find one anywhere so if I have actually missed one then I do apologise >.<
This is a sort of query/stroke confirmation really. If I have an image in the same place every time on a page (like a banner) that changes in the pages, could I set up size and layout specifics in the CSS then in the div on the page just link in the image so that it's formatted straight away by the CSS layout assigned to that particular div id? So for example in my div id "bannerImage" I have one image that is always say, centered and is 250px wide and 100px high. Instead of writing the positioning EVERY time on the pages, link to the div id in the css that has the above formats laid out in something like:
|
|
|
|
||||
|
Re: Setting a default image size using CSS?
What is your banner code? I may be able to simplify this for you if you explain how it is displayed.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Setting a default image size using CSS?
Whenever you use an <img>, you should specify the height and width. This speeds up browser rendering by telling the browser how much space to allocate. For example:
|
|
|||
|
Re: Setting a default image size using CSS?
Quote:
Duh.. of course.. that makes sense *facepalm* What I was really getting at more than the size was the formatting. Though a different image might be used on each page, they would be in the same place, same margin etc. Would it be better to just have the formatting on the HTML page or could it be linked in by the CSS? I'm still learning the ropes on CSS and am still working out what formatting is best left in the CSS and what is used in the HTML/content pages. |
|
|||
|
Re: Setting a default image size using CSS?
All of the other formatting -- position, borders, whatever -- should be controlled by CSS.
Nonetheless, the location of the <img> in your source code will normally affect its position. You might also want to read up on CSS background images. These are pure CSS with no <img> tag, and are good for decorative images (as opposed to content images). |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Image file size help | danny322 | Graphics and 3D | 6 | Nov 9th, 2007 11:20 |
| Repeating an image along the bottom of the page without setting it as background. | imagius | Web Page Design | 9 | Apr 27th, 2007 08:35 |
| What size image should I allow? | JustinStudios | Graphics and 3D | 10 | Apr 25th, 2007 23:57 |
| How to set default size for html page? | mohabitar | Web Page Design | 5 | Mar 11th, 2007 19:12 |
| Setting the directory to upload an image php | djme | PHP Forum | 2 | Jan 11th, 2006 15:39 |