467,879 Members | 1,100 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,879 developers. It's quick & easy.

Tweaking the style of child elements inline

Hi,

It's interesting if it is possible to use CSS rules for styling child
elements inline? What I mean is if there is a way to apply CSS rules
like this:

<ul style="li{ margin: 0; }"<!-- NOT SURE if it is possible in some
way -->
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
</ul>

I would like to apply some styles for child elements inline just like
we can do this as usual:

<style type="text/css">
li{margin: 0;}
</style>

Thank you.
Mar 1 '08 #1
  • viewed: 8599
Share:
5 Replies
al******@gmail.com wrote:
It's interesting if it is possible to use CSS rules for styling child
elements inline? What I mean is if there is a way to apply CSS rules
like this:

<ul style="li{ margin: 0; }"<!-- NOT SURE if it is possible in some
way -->
I don't think it is possible, the style attribute value is a list of CSS
properties with property name and value. You are trying to put a CSS
rule in there but that is not possible.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 1 '08 #2
On 2008-03-01, Martin Honnen <ma*******@yahoo.dewrote:
al******@gmail.com wrote:
>It's interesting if it is possible to use CSS rules for styling child
elements inline? What I mean is if there is a way to apply CSS rules
like this:

<ul style="li{ margin: 0; }"<!-- NOT SURE if it is possible in some
way -->

I don't think it is possible, the style attribute value is a list of CSS
properties with property name and value. You are trying to put a CSS
rule in there but that is not possible.
Indeed, although something like it was proposed at some time. I don't
know what happened but I don't think anyone's implemented it.
Mar 1 '08 #3
Scripsit al******@gmail.com:
It's interesting if it is possible to use CSS rules for styling child
elements inline?
It's off-topic in this group.
<ul style="li{ margin: 0; }"<!-- NOT SURE if it is possible in some
way -->
You're apparently thinking that there's something that prevents you from
using CSS normally. Making things up won't help. Please note that all
c.i.w.a.* groups are supposed to discuss authoring of WWW pages.

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

Mar 1 '08 #4
On Mar 1, 8:16*pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
Scripsit alain...@gmail.com:
It's interesting if it is possible to use CSS rules for styling child
elements inline?

It's off-topic in this group.
<ul style="li{ margin: 0; }"<!-- *NOT SURE if it is possible in some
way -->

You're apparently thinking that there's something that prevents you from
using CSS normally. Making things up won't help. Please note that all
c.i.w.a.* groups are supposed to discuss authoring of WWW pages.

--
Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/
The logic is that if inline styles are supported, then in some
particular cases you may find them useful. Of course, the least thing
I would like to do here is "to make things up". But you may agree with
me that again in some cases it can be quite handy to have such a
feature. CSS is evolving in such a way that newer versions allow you
to do things faster and reduce the amount of code. Thank you all for
participating in this discussion in any case. I thought I may have
missed this feature but it turns out it is not the case.
Mar 1 '08 #5
Jukka K. Korpela wrote:
Please note that all c.i.w.a.* groups are supposed to
discuss authoring of WWW pages.
Then why don't you do that? Normally you are a very good
contributor to newsgroups, but lately all we have heard
from you is criticism of the way people ask questions.

If you don't have anything to contribute, then don't post.
Mar 2 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by TheKeith | last post: by
2 posts views Thread by ivanhoe | last post: by
8 posts views Thread by Grzegorz ¦lusarek | last post: by
3 posts views Thread by MIS Director | last post: by
1 post views Thread by =?Utf-8?B?SmltSGVhdmV5?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.