By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,493 Members | 1,936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,493 IT Pros & Developers. It's quick & easy.

Tweaking the style of child elements inline

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.