PC Review


Reply
Thread Tools Rate Thread

CSS and image

 
 
=?Utf-8?B?V2F5bmUgV2VsbHM=?=
Guest
Posts: n/a
 
      9th May 2006
I have a CSS tag that formats a header on the page. Currently it has an image
as part of the description.
I have currently copied the tag(#desc) and pasted numerous instances of them
and renamed them to #desc1,2 etc, and used different images. I feel
reasonably certain that this is NOT the right way to put in different images
in the header of different pages. What is the right way to do this?

#desc {
height: 200px;
color: #ffffff;
padding: 0;
background: #505050 url('images/top.jpg') no-repeat top left;
clear: both;
margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
}

#desc1 {
height: 200px;
color: #ffffff;
padding: 0;
background: #505050 url('images/back.jpg') no-repeat top left;
clear: both;
margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
}

#desc2 {
height: 200px;
color: #ffffff;
padding: 0;
background: #505050 url('images/left.jpg') no-repeat top left;
clear: both;
margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
}



 
Reply With Quote
 
 
 
 
Trevor L.
Guest
Posts: n/a
 
      9th May 2006
Wayne Wells wrote:
> I have a CSS tag that formats a header on the page. Currently it has
> an image as part of the description.
> I have currently copied the tag(#desc) and pasted numerous instances
> of them and renamed them to #desc1,2 etc, and used different images.
> I feel reasonably certain that this is NOT the right way to put in
> different images in the header of different pages. What is the right
> way to do this?


Well, I am no CSS expert but what is wrong with this?

There is of course another way.
Use one rule (say #desc) and then use JS to alter the background image in
that rule.

While I have used JS to add a style, I haven't used it access an existing
rule and alter a style within that rule. I just know it can be done. If you
want to pursue ths avenue, I am sure others will reply with how to do it.

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      9th May 2006
Wayne Wells wrote:
> I have a CSS tag that formats a header on the page. Currently it has
> an image as part of the description.
> I have currently copied the tag(#desc) and pasted numerous instances
> of them and renamed them to #desc1,2 etc, and used different images.
> I feel reasonably certain that this is NOT the right way to put in
> different images in the header of different pages. What is the right
> way to do this?


Here is a slightly different way to do it

#desc , #desc1 , #desc2 /* , #desc3, #desc4 etc. */
{
height: 200px;
color: black; /* OR color: #fff; */
padding: 0;
background-color: #505050;
background-repeat: no-repeat
background-position: top left;
clear: both;
margin: 5px 0 0 0; /* OR margin-top: 5px ; */
}

#desc { background-image: url('images/top.jpg'); }
#desc1 { background-image: url('images/back.jpg'); }
#desc2 { background-image: url('images/left.jpg'); }
/* and similarly for #desc3, #desc4 etc. */

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
Ronx
Guest
Posts: n/a
 
      9th May 2006
I would use an external style sheet named styles.css in the examples
below, linked to all pages:
In the style sheet use

#desc {
height: 200px;
color: #ffffff;
padding: 0;
background: #505050 url('images/top.jpg') no-repeat top left;
clear: both;
margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
}

In every page, just before </head> in code view add
<link rel="stylesheet" href="styles.css" <type=text/css">
<style type="text/css">
#desc {background-image:url('images/topx.jpg');}
</style>
</head>

topx.jpg will replace top.jpg in that page. Change topx.jpg to the
correct image in each page.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/

"Wayne Wells" <(E-Mail Removed)> wrote in message
news:F7A39C03-8F7C-4730-ACD2-(E-Mail Removed)...
>I have a CSS tag that formats a header on the page. Currently it has
>an image
> as part of the description.
> I have currently copied the tag(#desc) and pasted numerous instances
> of them
> and renamed them to #desc1,2 etc, and used different images. I feel
> reasonably certain that this is NOT the right way to put in
> different images
> in the header of different pages. What is the right way to do this?
>
> #desc {
> height: 200px;
> color: #ffffff;
> padding: 0;
> background: #505050 url('images/top.jpg') no-repeat top left;
> clear: both;
> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
> }
>
> #desc1 {
> height: 200px;
> color: #ffffff;
> padding: 0;
> background: #505050 url('images/back.jpg') no-repeat top left;
> clear: both;
> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
> }
>
> #desc2 {
> height: 200px;
> color: #ffffff;
> padding: 0;
> background: #505050 url('images/left.jpg') no-repeat top left;
> clear: both;
> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
> }
>
>
>



 
Reply With Quote
 
Murray
Guest
Posts: n/a
 
      9th May 2006
Simple, functional, and practical. I like it.

--
Murray
--------------
MVP FrontPage


"Ronx" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I would use an external style sheet named styles.css in the examples below,
>linked to all pages:
> In the style sheet use
>
> #desc {
> height: 200px;
> color: #ffffff;
> padding: 0;
> background: #505050 url('images/top.jpg') no-repeat top left;
> clear: both;
> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
> }
>
> In every page, just before </head> in code view add
> <link rel="stylesheet" href="styles.css" <type=text/css">
> <style type="text/css">
> #desc {background-image:url('images/topx.jpg');}
> </style>
> </head>
>
> topx.jpg will replace top.jpg in that page. Change topx.jpg to the
> correct image in each page.
> --
> Ron Symonds - Microsoft MVP (FrontPage)
> Reply only to group - emails will be deleted unread.
> FrontPage Support: http://www.frontpagemvps.com/
>
> "Wayne Wells" <(E-Mail Removed)> wrote in message
> news:F7A39C03-8F7C-4730-ACD2-(E-Mail Removed)...
>>I have a CSS tag that formats a header on the page. Currently it has an
>>image
>> as part of the description.
>> I have currently copied the tag(#desc) and pasted numerous instances of
>> them
>> and renamed them to #desc1,2 etc, and used different images. I feel
>> reasonably certain that this is NOT the right way to put in different
>> images
>> in the header of different pages. What is the right way to do this?
>>
>> #desc {
>> height: 200px;
>> color: #ffffff;
>> padding: 0;
>> background: #505050 url('images/top.jpg') no-repeat top left;
>> clear: both;
>> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
>> }
>>
>> #desc1 {
>> height: 200px;
>> color: #ffffff;
>> padding: 0;
>> background: #505050 url('images/back.jpg') no-repeat top left;
>> clear: both;
>> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
>> }
>>
>> #desc2 {
>> height: 200px;
>> color: #ffffff;
>> padding: 0;
>> background: #505050 url('images/left.jpg') no-repeat top left;
>> clear: both;
>> margin-left:0; margin-right:0; margin-top:5px; margin-bottom:0
>> }
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any way to search image of my local drive with Image name or Image Title, Description infiraghu@gmail.com Microsoft Excel Programming 3 3rd Aug 2007 01:44 PM
Hot Links on an image..Can they remain with image if image moved Tony M Microsoft Frontpage 7 12th Apr 2007 06:25 AM
Control image property locking image file even after image cleared steve Microsoft VB .NET 4 6th Jul 2006 02:57 AM
Acronis True Image 7.0: Image verify, and bootable DVD image write? Matt Windows XP General 14 16th Jan 2004 03:08 AM
Acronis True Image 7.0: Image verify, and bootable DVD image write? Matt Storage Devices 12 16th Jan 2004 12:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:04 AM.