• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Murach's HTML5 and CSS3: Declare style for a specific selector with an inline declaration

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I would like to know if it is possible to declare the style for a specific selector with an inline declaration. Let's take an example.

I can declare a CSS class for the style of the "focus" selector, like:



and add the myInput class to a field in my html

Is it possible to do the same declaration but inline in the input html code, i.e. by doing

I am convinced it is better to do it through class definition and not inline, but I am just curious!

Thanks in advance

And thanks to JavaRanch for the book promotions!




>
 
author
Posts: 42
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not inline using the style attribute. I suppose you could do something like that by using the old school onFocus handler though.

Zak
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Though be aware that "old school" is the operative term here. Mixing behavior into the structure is very much considered "old school", which is a nice way of saying obsolete and poor practice, which is a nice way of saying "regarded with derision".
 
Renaud Tarnec
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to both of you for your anwsers. I do agree that this very old school and not recommended... as I said it was more about curiosity! Thanks for your time.
 
Zak Ruvalcaba
author
Posts: 42
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Though be aware that "old school" is the operative term here. Mixing behavior into the structure is very much considered "old school", which is a nice way of saying obsolete and poor practice, which is a nice way of saying "regarded with derision".



Agreed.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic