473,386 Members | 1,715 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.

HR as a graphic image

Is it possible to use CSS to define <hr> as a graphic image?

FrontPage 2003 has apparently dropped the graphic hr from their themes and I
am becoming more involved in using CSS, but would like to retain the
automatic inclusion of a graphic in place of hr.

I have a 300 px graphic I'd like to continue using, without a manual search
and replace of <hr> on 300 web pages....

Thanks,

Chris Hopkins
www.parthia.com

Jul 20 '05 #1
5 11104
"Charax" <ch******@ameritech.net> wrote:
Is it possible to use CSS to define <hr> as a graphic image?
Strictly speaking not, since you cannot add image content using CSS,
but you can specify a background image.
I have a 300 px graphic I'd like to continue using, without a
manual search and replace of <hr> on 300 web pages....


I wonder what you have been using (in terms of HTML and CSS, i.e. what
FrontPage has inserted for you), but the following would seem
reasonable:

hr { display: block;
width: 300px;
height: 10px;
background: url(deco.gif); }

Replace 10px by the height of your image.

This however leaves a border around the image on IE. I don't know why -
and setting border: none doesn't remove it.

This reminded me of Alan Flavell's "CSS1 and the Decorative HR",
http://ppewww.ph.gla.ac.uk/~flavell/www/hrstyle.html
which explains how complicated the issue is.

Personally I think using something like
<div><img alt="End of section." src="deco.gif"></div>
is a feasible alternative to using <hr> and then trying to style it
into an image. After all, <hr> itself is at least half-presentational,
and we generally use <img> to add purely decorative images. (Writing
adequate alt attributes is more important than being theoretically
puristic about not using "presentational tags".)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #2
In article <bs************@ID-177935.news.uni-berlin.de> in
comp.infosystems.www.authoring.stylesheets, Charax wrote:
Is it possible to use CSS to define <hr> as a graphic image?


Yes, and Alan Flavell has a nice page that tells you how.

http://ppewww.ph.gla.ac.uk/~flavell/www/hrstyle.html

--
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 #3
On Sun, 28 Dec 2003, Jukka K. Korpela wrote:
This reminded me of Alan Flavell's "CSS1 and the Decorative HR",
http://ppewww.ph.gla.ac.uk/~flavell/www/hrstyle.html
which explains how complicated the issue is.
Thanks for the plug ;-)

To be honest, it explains how complicated the issue _was_ at the time
that I wrote it: as the preface says, it was devised in the hope of
getting something that worked also in IE4, NN4.* etc.

Nowadays I would probably prefer to shield the older browsers from
most of the CSS, and use a more straightforward, spec-conforming
stylesheet to get the effect in more recent versions. After all,
it's only meant as a cosmetic device, and when the chips are down
the details of the presentation are meant to be optional.
Personally I think using something like
<div><img alt="End of section." src="deco.gif"></div>
is a feasible alternative to using <hr> and then trying to style it
into an image. After all, <hr> itself is at least half-presentational,
and we generally use <img> to add purely decorative images. (Writing
adequate alt attributes is more important than being theoretically
puristic about not using "presentational tags".)


I'm not going to argue with your basic thesis there - but perhaps with
the detail: it would be helpful if you said directly what "adequate"
alt attribute you would consider acceptable in such a case?

In interpreting an <hr>, I presume that a speaking browser would be
expected to insert a longer than usual pause, or something of that
kind?

Jul 20 '05 #4
> Nowadays I would probably prefer to shield the older browsers from
most of the CSS, and use a more straightforward, spec-conforming
stylesheet to get the effect in more recent versions. After all,
it's only meant as a cosmetic device, and when the chips are down
the details of the presentation are meant to be optional.


Alan,

This is an intriguing approach. Can you point me to a source of info on how
to shield earlier browsers from CSS? I still have a lot of traffic from
Version 4 browsers (and, alas, even earlier versions, but I have stopped
trying to support them).

Your web page on HR substitution was very helpful.

Thank you,

Chris Hopkins
www.parthia.com

Jul 20 '05 #5
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
Personally I think using something like
<div><img alt="End of section." src="deco.gif"></div>
is a feasible alternative to using <hr> and then trying to style
it into an image. After all, <hr> itself is at least
half-presentational, and we generally use <img> to add purely
decorative images. (Writing adequate alt attributes is more
important than being theoretically puristic about not using
"presentational tags".)
I'm not going to argue with your basic thesis there - but perhaps
with the detail: it would be helpful if you said directly what
"adequate" alt attribute you would consider acceptable in such a
case?


Well, things like "End of section." Words that you would use if you
read some text aloud and wanted to indicate major divisions, or changes
of topic, using some explanatory words. At
http://www.cs.tut.fi/~jkorpela/html/alt.html#hr
I even suggest a verbose explanation like
alt="End of page content proper. Contact information follows."
The point is that more information is needed than in visual
presentation, where the user can more or less draw conclusions from the
overall appearance and from small things like that fact that a
horizontal line is near the end of a page.
In interpreting an <hr>, I presume that a speaking browser would be
expected to insert a longer than usual pause, or something of that
kind?


That's what HTML specifications have suggested, and it is a natural
expectation. In a sense we lose that possibility when we don't use
<hr>, but the explanatory words are like a long pause filled with
metainformation. It's a pity that we cannot effectively suggest a
different tone of voice for it, or a pause, using CSS.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #6

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

Similar topics

2
by: curwen | last post by:
Hi, I have problem to create a well formed xsl-fo document using images dynamically generated from an http request using this tag: <fo:external-graphic content-type="content-type:image/gif"...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
1
by: ray well | last post by:
hi, i need to give the user the ability to extract a rectangular area of their choice from a graphic displayed in a picture box to the clipboard, so they can use it elsewhere. say the graphic...
3
by: briand | last post by:
I am writting a control that paints an image to a graphic (created from a bmp). I want to be able to display the painted image directly without having to save to file and link to the saved image....
4
by: André | last post by:
Hi, I try to create and render a graphic among other objects like e.g. tables, labels, buttons. The tables are not a problem, neither the graphic. My problem is that i can't render both...
2
by: tshad | last post by:
I have an aspx window that is going to open a window (javascript) and display a graphic. I want to resize the window to the size of the graphic before it actually displays - how do I do that? ...
1
by: icepick72 | last post by:
On an academic note, I want to copy a Graphic to an Image (Bitmap). I have the Graphic object but not the origin image from which it originates; this is because I'm overriding the PrintDocument...
5
by: janiceelizabeth | last post by:
I would like to place a graphic before each of my H2 headers using CSS. All looks Ok using a simple vertical align property for the image (which is larger than the text height) until I reduce the...
4
by: Jonathan Wood | last post by:
I've figured out how to create an image on the fly on my Website. Once created, I write the image to the page using code like this: Bitmap bm = Response.ContentType = "image/jpeg";...
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: 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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.