Forum Moderators: open

Message Too Old, No Replies

Inline style in my code don't work for Firefox and opera

Inline style usage in FireFox and Opera

         

shalj

6:07 pm on Jun 27, 2007 (gmt 0)

10+ Year Member



Hi all, hope i m posting my ques under write category..
I am using Clip property of CSS to crop my image. I am using this property in my HTML code as follows:

<html>
<head>
<style type="text/css">
img
{
position:absolute;
top:100px;
}
</style>
</head>
<body>

<img id="img1" border="0" src="logocss.gif" width="95" height="84" style="clip=rect(0px,50px,50px,0px)"/>

</body>
</html>

Now the problem that i am encountering is this above code works fine in internet explorer but it is in not working in Mozilla and Opera...any pointers to this problem? How can i achieve same functionality in these browsers.IS there any syntax issue?

encyclo

6:50 pm on Jun 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is an error in your CSS syntax, which IE accepts but other browsers do not.
clip=rect
should read:
clip[b]:[/b]rect
- a colon not an equals sign.

Fotiman

6:52 pm on Jun 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




style="clip=rect(0px,50px,50px,0px)"

In CSS, property declarations have the form "name : value" and are separated by a semi-colon. Change your code to this:

style="clip:rect(0px,50px,50px,0px)"

shalj

4:15 pm on Jun 29, 2007 (gmt 0)

10+ Year Member



Thanks encyclo and Fontiman for your answer..Its working now in both the browsers