473,385 Members | 1,397 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,385 software developers and data experts.

Replacing <IMG ALIGN=RIGHT ...> with CSS equivalent

When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }

I notice that the effect is NOT the same. While in the past the text was flowing smoothly around the picture
on the right side there is now a hard cut: Text, then picture below with white space on the left and finally
the text continues BELOW the picture.

How do I achieve that the text is flowing around the picture as before ?

T.

Jul 20 '05 #1
12 95506
Ted Mencini wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }

I notice that the effect is NOT the same
This is becuase there is no "aligh" property in CSS.
How do I achieve that the text is flowing around the picture as before ?


Look up the float property

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #2
Ted Mencini wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }


When using CSS, you don't simply put HTML attributes into a stylesheet. CSS
has its own set of properties that only occasionally overlap with obsolete
HTML attributes.

There is no such property as 'align' in CSS. You are looking for the
'float' property. If a browser does anything with an align property, then
it's proprietary behaviour that will not work across multiple browsers.

<p>
<img src="..." alt="..." />
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus ornare,
justo vitae faucibus ornare, est enim pretium elit, in hendrerit tortor
purus ac dolor. Class aptent taciti sociosqu ad litora torquent per conubia
nostra, per inceptos hymenaeos. Ut et nisl. Fusce sed erat. Proin ut est eu
arcu interdum volutpat. Vestibulum nibh velit, congue nec, sodales vel,
faucibus eu, magna. Cras odio quam, adipiscing nec, luctus eu, pellentesque
nec, urna. Integer feugiat, velit et ultrices tempus, sapien erat molestie
dolor, id pretium felis justo ac lectus. Cum sociis natoque penatibus et
magnis dis parturient montes, nascetur ridiculus mus. Fusce nec erat. Nam
euismod tortor eget urna. Praesent vestibulum.
</p>

img {
float: right;
}

--
Jim Dabell

Jul 20 '05 #3
A curious thing is happening, when I use display:inline; and background:
url(); my object(<div> do you call that an object?) disappears.

Jim Dabell wrote:
Ted Mencini wrote:

When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }

When using CSS, you don't simply put HTML attributes into a stylesheet. CSS
has its own set of properties that only occasionally overlap with obsolete
HTML attributes.

There is no such property as 'align' in CSS. You are looking for the
'float' property. If a browser does anything with an align property, then
it's proprietary behaviour that will not work across multiple browsers.

<p>
<img src="..." alt="..." />
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus ornare,
justo vitae faucibus ornare, est enim pretium elit, in hendrerit tortor
purus ac dolor. Class aptent taciti sociosqu ad litora torquent per conubia
nostra, per inceptos hymenaeos. Ut et nisl. Fusce sed erat. Proin ut est eu
arcu interdum volutpat. Vestibulum nibh velit, congue nec, sodales vel,
faucibus eu, magna. Cras odio quam, adipiscing nec, luctus eu, pellentesque
nec, urna. Integer feugiat, velit et ultrices tempus, sapien erat molestie
dolor, id pretium felis justo ac lectus. Cum sociis natoque penatibus et
magnis dis parturient montes, nascetur ridiculus mus. Fusce nec erat. Nam
euismod tortor eget urna. Praesent vestibulum.
</p>

img {
float: right;
}


Jul 20 '05 #4
Before doing anything else, please fix the wrapping in your newsreader.

Ted Mencini wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS
definition

<IMG class=right ...>
not the best choice for a class name.
xxx.css:

IMG.right { BORDER: 0; align: right }

I notice that the effect is NOT the same.
As well it shouldn't, since there is no align property in CSS.
How do I achieve that the text is flowing around the picture as
before ?


Start by reading the manual
http://www.w3.org/TR/REC-CSS2/

or a tutorial
http://www.google.com/search?q=css%20tutorial

If you want text to flow around the image, then you probably want

img {float: right;}

--
Brian
follow the directions in my address to email me

Jul 20 '05 #5
In article <bt*************@news.t-online.com>,
te*******@hotmail.com (Ted Mencini) wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }
In CSS there is no such thing as the align property.

I notice that the effect is NOT the same. While in the past the text was
flowing smoothly around the picture
on the right side there is now a hard cut: Text, then picture below with
white space on the left and finally
the text continues BELOW the picture.

How do I achieve that the text is flowing around the picture as before ?


img.right { border: 0; float: right; }

--
Kris
kr*******@xs4all.netherlands (nl)
Jul 20 '05 #6

"Ted Mencini" <te*******@hotmail.com> wrote in message
news:bt*************@news.t-online.com...
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }

The style should be:

img.right { float: right; }

and the HTML

<img class="right" other attributes /><p>text goes here</p>
Jul 20 '05 #7
On Sun, 04 Jan 2004 17:14:40 +0100, Ted Mencini wrote:
How do I achieve that the text is flowing around the picture as before ?


Try floating it? (float:right)

--

..

Jul 20 '05 #8
te*******@hotmail.com (Ted Mencini) wrote in
news:bt*************@news.t-online.com:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }

I notice that the effect is NOT the same. While in the past the text
was flowing smoothly around the picture on the right side there is now
a hard cut: Text, then picture below with white space on the left and
finally the text continues BELOW the picture.

How do I achieve that the text is flowing around the picture as before


float: right
Jul 20 '05 #9
Ted Mencini wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...> [snip] IMG.right { BORDER: 0; align: right }
I wasn't aware of an "align" property!

I use a style such as:

img.right { float: right; }
I notice that the effect is NOT the same. While in the past the text
was flowing smoothly around the picture on the right side there is
now a hard cut: Text, then picture below with white space on the left
and finally the text continues BELOW the picture.

How do I achieve that the text is flowing around the picture as
before ?


I lied about the above (for simplicity). What I really use is something like:

img.right { float: right; margin: 0.5em 0 0.5em 1em; }

This pushes the image to the right as far as it can go, but leaves some space
around it.

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #10
Ted Mencini wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>

xxx.css:

IMG.right { BORDER: 0; align: right }

I notice that the effect is NOT the same. While in the past the text was flowing smoothly around the picture
on the right side there is now a hard cut: Text, then picture below with white space on the left and finally
the text continues BELOW the picture.

How do I achieve that the text is flowing around the picture as before ?


IMG { float: right }

Jul 20 '05 #11
In article <bt*************@news.t-online.com> in
comp.infosystems.www.authoring.html, Ted Mencini wrote:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition

<IMG class=right ...>
This is not strictly invalid yet, but (1) it's a bad idea to use a
CSS keyword as a class name, (2) you should put quotes around the
class name, and (3) you should put element names in lower case.
(The second and third points look forward to XHTML compatibility.)
IMG.right { BORDER: 0; align: right }


Note followups to this CSS question to ciwas, where it should have
been posted in the first place. Will you PLEASE not crosspost every
question you have?

"align" is not a valid property. What you want is
{ border: none; float: right }
Note also that you want to say "img" not "IMG".

See the CSS spec URL in my sig. It's always a good idea to check the
or validate your HTML and CSS -- preferably both.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #12
Stan Brown wrote:

(1) it's a bad idea to use a CSS keyword as a class name, (2) you
should put quotes around the class name, and (3) you should put
element names in lower case. (The second and third points look
forward to XHTML compatibility.)


I agree with (1) and (2), but I'm not so sure about (3). I always use
caps for elements. And I see no reason to move toward xhtml, so I
don't see it as an issue. I'd venture to say that the best choice for
most www authors is html 4.01/strict, and not xhtml (in any variety).

--
Brian
follow the directions in my address to email me

Jul 20 '05 #13

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

Similar topics

10
by: Gianpiero Colagiacomo | last post by:
VBScript: Can anyone help me figure out why the image within this IF statement shows as a place holder rather than the image itself when the statement is returning true? If I remove the IF...
15
by: Philipp Lenssen | last post by:
My friend has the following problem (background: we want to transform XML to XHTML via XSLT): "We copy XHTML fragments into an output by using the following template: <xsl:template match="*"...
7
by: Zhang Weiwu | last post by:
Hello. This is problem puzzled me a long time. I wish to organize some block elements and let them flow one after each other like text. Think about a album, I wish the album have 12 thumbnails,...
2
by: btfbg | last post by:
I am using Response.ContentType = "application/msword" Response.AddHeader "Content-Disposition", "attachment;filename=Letter.doc" to download my asp page to the client. The download process...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
2
by: R.A.M. | last post by:
Hello, (sorry for my English...) Could you help me please with one asp.net problem? I am beginner... I am writting simple Demo .NET application. On start page I have: <h1>Demo .NET</h1> <br...
4
by: manu3d | last post by:
Hi everybody, I'm using the event "onload" to trigger a function when an image has been preloaded. But it seems to me that the function is triggered right at the beginning of the transfer from...
4
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image...
6
by: terry13 | last post by:
Hi there, This code is working fine in IE7 as submit button for the search form, but not in Firefox. Any ideas why. <img src="../../Images/Go.jpg" width="45" height="20" align="absmiddle"...
4
by: bgold12 | last post by:
Hey, I've come across a strange behaviour that shows itself in IE 7.0 and Firefox 3 and probably other browsers. In the code below, which is a complete HTML document which validates as XHTML 1.0...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.