473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Moving image properties to CSS

I am currently using one of the IE hacks to give a PNG image full alpha
transparency. But I wanted to move as much of this data to a .CSS as possible
to lighten the load in the HTML as it is uses on every page. Here is my HTML:

<div id="logo1"
style="width:128px;height:100px;filter:progid:DXIm ageTransform.Microsoft.AlphaIm
ageLoader(src='images/logo-128x100x32.png');">
<img style="filter:progid:DXImageTransform.Microsoft.Al pha(opacity=0);"
src="../images/logo-128x100x32.png" width="128" height="100" border="0"
alt="Matroska Logo">
</div>

Here is the CSS I am using for it:

#logo1 {
position: absolute;
top: 10px;
left: 10px;
}

What all can I move to the .CSS file? I am most interested in moving the style
properties over.
Atamido


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 20 '05 #1
12 14837
John wrote:
I am currently using one of the IE hacks to give a PNG image full alpha
transparency. But I wanted to move as much of this data to a .CSS as possible
to lighten the load in the HTML as it is uses on every page. Here is my HTML:

<div id="logo1"
style="width:128px;height:100px;filter:progid:DXIm ageTransform.Microsoft.AlphaIm
ageLoader(src='images/logo-128x100x32.png');">
<img style="filter:progid:DXImageTransform.Microsoft.Al pha(opacity=0);"
src="../images/logo-128x100x32.png" width="128" height="100" border="0"
alt="Matroska Logo">
</div>

Here is the CSS I am using for it:

#logo1 {
position: absolute;
top: 10px;
left: 10px;
}

What all can I move to the .CSS file? I am most interested in moving the style
properties over.


You can move all the style properties over. That's what they are -- inline
CSS.

#logo1 {
position:absolute;
top:10px;
left:10px;
width:128px;
height:100px;
filter:progid:DXImageTransform.Microsoft.AlphaImag eLoader(src='images/logo-128x100x32.png');
}

#logo1 img {
filter:progid:DXImageTransform.Microsoft.Alpha(opa city=0);
width: 128px;
height: 100px;
border: none;
}

<div id="logo1"><img src="../images/logo-128x100x32.png" alt="Matroska Logo"></div>

--
Matt

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #2
"Matt" wrote...
You can move all the style properties over. That's what they are -- inline
CSS.

#logo1 {
position:absolute;
top:10px;
left:10px;
width:128px;
height:100px;
filter:progid:DXImageTransform.Microsoft.AlphaImag eLoader(src='images/logo-128x1
00x32.png'); }

#logo1 img {
filter:progid:DXImageTransform.Microsoft.Alpha(opa city=0);
width: 128px;
height: 100px;
border: none;
}

<div id="logo1"><img src="../images/logo-128x100x32.png" alt="Matroska

Logo"></div>

Well both IE and Mozilla render the page fine like that, but now the CSS won't
validate. It doesn't like all of the colons in
filter:progid:DXImageTransform.Microsoft.AlphaImag eLoader(src='images/logo-128x1
00x32.png');

Is there any way to fix it so that it validates? Also, is there any way to put
the src="" and alt="" in the .CSS?

Thanks for your help!
Atamido


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 20 '05 #3
John wrote:
is there any way to put the src="" and alt="" in the .CSS?


No; those are part of the content of the document, and are outside of
the scope of css.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #4
On Mon, 05 Jul 2004 23:20:10 -0400, Brian
<us*****@julietremblay.com.invalid> wrote or quoted :
is there any way to put the src="" and alt="" in the .CSS?


No; those are part of the content of the document, and are outside of
the scope of css.


If you have a repeating logo associated with a style, you can do
something like this:

..new /* anything new */ {
background : url(images/plant.gif) #ffffff no-repeat scroll
3px 3px;
border : dashed;
clear : none;
color : #9400d3;
display : block;
margin : 8px 0px 8px 0px;
padding : 10px 8px 10px 40px;
}

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 20 '05 #5
Roedy Green wrote:
[attribute re-inserted] John wrote:
is there any way to put the src="" and alt="" in the .CSS?


If you have a repeating logo associated with a style, you can do
something like this:

.new /* anything new */ {
background : url(images/plant.gif) #ffffff no-repeat


[additional css snipped]

What has this to do with alt and src attributes of an <img> element?

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #6
Quoth the raven Brian:
Roedy Green wrote:
[attribute re-inserted] John wrote:

is there any way to put the src="" and alt="" in the .CSS?


If you have a repeating logo associated with a style, you can do
something like this:

.new /* anything new */ {
background : url(images/plant.gif) #ffffff no-repeat


[additional css snipped]

What has this to do with alt and src attributes of an <img> element?


It moves the image to the background where no alt is required. In
fact, no <img> element is required either. <g>

--
-bts
-This space intentionally left blank.
Jul 20 '05 #7
On Tue, 06 Jul 2004 00:26:08 -0400, Brian
<us*****@julietremblay.com.invalid> wrote or quoted :
.new /* anything new */ {
background : url(images/plant.gif) #ffffff no-repeat


[additional css snipped]

What has this to do with alt and src attributes of an <img> element?


the url is roughly the equivalent of img src.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 20 '05 #8
John wrote:
"Matt" wrote...

Well both IE and Mozilla render the page fine like that, but now the CSS won't
validate. It doesn't like all of the colons in
filter:progid:DXImageTransform.Microsoft.AlphaImag eLoader(src='images/logo-128x1
00x32.png');

Is there any way to fix it so that it validates?


Use IE conditional comments to reference an IE-specific style sheet. The
validator won't see it, but IE will.

Example at http://billericaybaptist.net/ including both IE5 and IE6
style sheets, although this is just for box model fixes.

--
Mark.
Jul 20 '05 #9
"Beauregard T. Shagnasty" <a.*********@example.invalid> writes:
Quoth the raven Brian:
Roedy Green wrote:
[attribute re-inserted] John wrote:
> is there any way to put the src="" and alt="" in the .CSS?

If you have a repeating logo associated with a style, you can do
something like this:

.new /* anything new */ {
background : url(images/plant.gif) #ffffff no-repeat

[additional css snipped]
What has this to do with alt and src attributes of an <img> element?


It moves the image to the background where no alt is required. In
fact, no <img> element is required either. <g>


Where no alt is required *provided* that had an <img> been used to
display the image alt="" would have been appropriate.

--
Chris
Jul 20 '05 #10
*Mark Tranchant* <ma**@tranchant.plus.com>:

Use IE conditional comments to reference an IE-specific style sheet.
The validator won't see it, but IE will.


That's just bogus. If you're using non-standard HTML or CSS then stand for
it and don't cloak it.

--
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass has an appropriate reserve space.
To the economist, the glass is twice as big as it needs to be.
Jul 20 '05 #11
Christoph Paeper wrote:
Use IE conditional comments to reference an IE-specific style sheet.
The validator won't see it, but IE will.
That's just bogus. If you're using non-standard HTML or CSS then stand
for it and don't cloak it.


But I'm not - if you're using a real browser. My HTML and CSS is
completely standard to a proper UA, with just a redundant comment in the
HTML.

Much as I don't like supporting MSIE [1], it is pretty much essential
for non-personal sites. By doing it this way, using a
standards-compliant comment that MSIE happens to parse, I get the best
of both worlds: standards-compliant code and fixes for MSIE.

[1] http://tranchant.plus.com/ie

--
Mark.
Jul 20 '05 #12
On Tue, 6 Jul 2004, Christoph Paeper wrote:
*Mark Tranchant* <ma**@tranchant.plus.com>:

Use IE conditional comments to reference an IE-specific style sheet.
The validator won't see it, but IE will.


That's just bogus.


I quite agree! Nevertheless, it does no harm to WWW-conforming
browsers (which would be my priority, but there's also a real world to
consider), and it keeps the operating-system-component happy (which
avoids pointless complaints from senior manglement who don't know any
better). So (although to be honest I'm not doing it myself to any
extent - although I know a web designer whose authoring tool does it
anyway), I think it's a tolerable response to an unfortunate
situation.

Which, on the other hand, is no attempt to persuade you to go that way
yourself if you don't want to!

good luck

Jul 20 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
Hi, I am trying to set the position of a picture inside a picturebox with the folowing code: pctOutput.Picture = LoadPicture(App.Path & "\picture.bmp", , , , ) I didn't know what to fill...
1
by: gdgass | last post by:
Hi, I'm in the process of developing an app to scan and archive photos based upon the EXIF/Photo Keyword property. One of the requirements is that the Photo's keywords be editable via Digital...
10
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. Have a simple Browser detect script to sort IE...
1
by: rsteph | last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
9
by: Peter Webb | last post by:
I want to animate one object moving in front of another. I cannot re-render the background as the object moves, as it would be extremely time consuming. This is what I would like to do. I draw...
0
by: linkswanted | last post by:
http://www.movingcompanies.co.il/supplies/boxes.html http://www.movingcompanies.co.il/residental/ http://www.movingcompanies.co.il/commercial/corporate-moves.html...
0
by: linkswanted | last post by:
We are your trusted source. World Moving & Storage is bonded and licensed by the U.S. Department of Transportation and is one of the largest residential moving and corporate relocation company in...
0
by: linkswanted | last post by:
We are your trusted source. World Moving & Storage is bonded and licensed by the U.S. Department of Transportation and is one of the largest residential moving and corporate relocation company in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.