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

marker in h1

Hello,
I thought it would be a nice idea if I could set an icon in front of a h1
level title. I want to do this as in my site this specific h1 class marks a
certain thing that comes back over and over again. So people recognize this
as what it means.
In fact it is the title of an article, so I want an icon depicting 'article'
in front of the title. I saw in the css2 specs the option of markers. but I
cann't get it to work.

display: marker;
content: url(.....);

shouldn't that be enough?
Dec 17 '06 #1
4 2082
Sjef <ma*************@planet.nlwrote:
In fact it is the title of an article, so I want an icon depicting
'article' in front of the title. I saw in the css2 specs the option of
markers. but I cann't get it to work.
None of the "big" browsers supports markers. But you may use something
like this instead:

h1.article:before {
content: url(image.jpg);
/* ... */
}

This is supported by many browsers.

--
Alexander
Dec 17 '06 #2
jim

Sjef,
Hope the following will work for you.
reference the icon image as a background image for the H1 element; then
position it (if needed) to be centered with the text; lastly, give your
text some padding on the left side so the text does not block the icon:
===============================
<style type="text/css">
..h1icon{
background-image: url(icon.jpg);
background-repeat: no-repeat;
background-position:0% 50%;
padding-left:25px;
}
</style>
</head>
<body >
<h1 class="h1icon"An H1 Element</h1>
===============================

-Jim

Dec 17 '06 #3
Scripsit Sjef:
I thought it would be a nice idea if I could set an icon in front of
a h1 level title.
There are (at least) two ways of achieving that. You can set display:
list-item for the h1 element and then set a suitable marker image. This may
look odd, since it's not really a list item and it's not even syntactically
part of any list, but CSS implementations don't know that. Another approach
is to set a non-repeating background image. This might be a better approach,
since it lets you tune the vertical position of the image with respect to
the heading.

In the first approach, make sure you set a sufficiently large left margin so
that there is room for the image. This is one of the few cases where px unit
makes sense, since the image itself has fixed dimensions in pixels. Example:

h1 { display: list-item;
margin-left: 30px;
list-style-image: url(article.gif); }

In the second approach, you need some suitable left padding. It must be
padding, not margin, since the background image is used for the padding but
not for the margin.

h1 { background-image: white url(article.gif) left center no-repeat;
padding-left: 30px; }
I saw in the css2 specs the option
of markers. but I cann't get it to work.
Such features have almost entirely been left unimplemented, and they have
been removed from the CSS 2.1 drafts.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 17 '06 #4
Thanks for the answers. I will try all options, if only for the sake of
learing!
Sjef

"Jukka K. Korpela" <jk******@cs.tut.fischreef in bericht
news:jJ*****************@reader1.news.saunalahti.f i...
Scripsit Sjef:
>I thought it would be a nice idea if I could set an icon in front of
a h1 level title.

There are (at least) two ways of achieving that. You can set display:
list-item for the h1 element and then set a suitable marker image. This
may look odd, since it's not really a list item and it's not even
syntactically part of any list, but CSS implementations don't know that.
Another approach is to set a non-repeating background image. This might be
a better approach, since it lets you tune the vertical position of the
image with respect to the heading.

In the first approach, make sure you set a sufficiently large left margin
so that there is room for the image. This is one of the few cases where px
unit makes sense, since the image itself has fixed dimensions in pixels.
Example:

h1 { display: list-item;
margin-left: 30px;
list-style-image: url(article.gif); }

In the second approach, you need some suitable left padding. It must be
padding, not margin, since the background image is used for the padding
but not for the margin.

h1 { background-image: white url(article.gif) left center no-repeat;
padding-left: 30px; }
>I saw in the css2 specs the option
of markers. but I cann't get it to work.

Such features have almost entirely been left unimplemented, and they have
been removed from the CSS 2.1 drafts.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 17 '06 #5

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

Similar topics

5
by: Martin Trautmann | last post by:
Hi all, is there any standard for grip markers? I've found the fo:marker, but I look for some kind of support for "grip marker" or "side makers" - what's the correct English / XSL term to look...
25
by: Haines Brown | last post by:
I have a table with three columns, and I want the data in the first column to align left, while that in the remaining columns to align right: #testTable { text-align: right; } #leftcol {...
1
by: Wannabe_Geek | last post by:
Do we have something in ASP.net like freemarker for java.(freemarker.sourceforge.net) The idea is to use simple HTML file as template for the site and replace the Marker tags with appropriate...
0
by: geniet | last post by:
Hello all of you, I am looking for a program where I can add and edit the APP3 marker according to jps format (if needed Python/PIL can be used). The setup of the APP3 marker comes from this...
2
by: flymo | last post by:
Hello All, Hopefully this is the correct forum... I have some code that creates a text (dat) for a billing process created in Access2000, I add an Eof of Line marker to each line item and then...
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: 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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.