HighDots Forums  

Tweaking the style of child elements inline

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss Tweaking the style of child elements inline in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
alainfri@gmail.com
 
Posts: n/a

Default Tweaking the style of child elements inline - 03-01-2008 , 09:59 AM






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.

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Tweaking the style of child elements inline - 03-01-2008 , 11:14 AM






alainfri (AT) gmail (DOT) com wrote:

Quote:
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/


Reply With Quote
  #3  
Old   
Ben C
 
Posts: n/a

Default Re: Tweaking the style of child elements inline - 03-01-2008 , 11:54 AM



On 2008-03-01, Martin Honnen <mahotrash (AT) yahoo (DOT) de> wrote:
Quote:
alainfri (AT) gmail (DOT) 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.


Reply With Quote
  #4  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Tweaking the style of child elements inline - 03-01-2008 , 12:16 PM



Scripsit alainfri (AT) gmail (DOT) com:

Quote:
It's interesting if it is possible to use CSS rules for styling child
elements inline?
It's off-topic in this group.

Quote:
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/



Reply With Quote
  #5  
Old   
alainfri@gmail.com
 
Posts: n/a

Default Re: Tweaking the style of child elements inline - 03-01-2008 , 01:16 PM



On Mar 1, 8:16*pm, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:
Quote:
Scripsit alain... (AT) gmail (DOT) 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.


Reply With Quote
  #6  
Old   
GTalbot
 
Posts: n/a

Default Re: Tweaking the style of child elements inline - 03-01-2008 , 03:42 PM



On 1 mar, 10:59, alain... (AT) gmail (DOT) com wrote:
Quote:
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

Hello,

First of all, list items are block-level elements. The only thing that
makes them differ from ordinary block-level elements is that they have
a list marker. So, an <li> element is a block-level element with a
list marker. An <li> is not an inline element. Your posted message
could be equivocal on this issue: I'm just making this clear,
explicit.

Second, inline style is discouraged and should be discouraged
everywhere it happens. If the goal of CSS was to create a clear
separation of content from presentation, then using inline style
contradicts such purpose. Creating a clear separation of content from
presentation has many benefits over traditional tag soup.

7. Why use CSS to separate content from presentation?
http://www.maxdesign.com.au/presenta...ts/index07.htm
(excellent presentation btw)

HTML 4.01, section 2.4.1
Separate structure and presentation
http://www.w3.org/TR/html4/intro/intro.html#h-2.4.1

Using Web Standards in your Web Pages
The benefits for clear separation of content from presentation aspects
(font, color, padding, margin, border, etc.) thanks to CSS
implementation
http://developer.mozilla.org/en/docs...ementation_are

"
Inline
By using the attribute style, you can apply CSS directly to an HTML
element:
<h1 style="font-weight:bold;">Rubrik</h1>
This should be avoided since it mixes structure and presentation.
"
Developing With Web Standards
Recommendations and best practices
http://www.456bereastreet.com/lab/de...dards/css/#css

HTML 5 will go even further into such direction.There are talks about
removing the style attribute in HTML 5.

Gérard


Reply With Quote
  #7  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Tweaking the style ..., Mr. Korpela - 03-02-2008 , 05:38 PM



Scripsit example (AT) example (DOT) com:

Quote:
If you don't have anything to contribute, then don't post.
The absurdity of useless posting saying that is not funny. Please keep
using the same fake identity as long as you remain an anonymous coward
who posts nonsense. Thank you in advance.

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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.