CSS::Ob...::Inline(3)

πŸ“¦ version 0.2.0, in alpine 3.24

πŸ’– NAME πŸ’–

okay bestie, welcome to CSS::Ob...::Inline(3) from User Contributed Perl Documentation ✨ This page is all about CSS::Object::Format β€” the CSS Object Oriented Stringificator for Inline CSS. πŸ’…


✨ SYNOPSIS ✨

Here's the whole vibe, copy-paste ready:

use CSS::Object::Format::Inline;
my $format = CSS::Object::Format::Inline->new( debug => 3 ) ||
    die( CSS::Object::Format::Inline->error );
my $prop = CSS::Object::Property->new(
    format => $format,
    debug => 3,
    name => 'display',
    value => 'inline-block',
) || die( CSS::Object::Property->error );
print( $prop->as_string );

🌈 VERSION 🌈

It's giving v0.2.0, bestie πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

CSS::Object::Format is an object-oriented CSS parser and manipulation interface for writing properties that are suitable to be added inline β€” like, literally inside an HTML element's style attribute. Iconic. ✨

This package inherits from CSS::Object::Format.

🚨 Because it's designed to be inline, there cannot be multiple rules. There is only one implicit rule, and it's used solely to hold all the properties. No cap.

πŸ› οΈ CONSTRUCTOR πŸ› οΈ

🌟 new

To instantiate a new CSS::Object::Format object, pass a hash reference of the following parameters:

  • debug β€” this is an integer. The bigger it is, the more verbose the output gets. Lowkey useful when you're snooping on what's happening πŸ‘€

🧚 METHODS 🧚

πŸ“ rule_as_string

Provided with a CSS::Object::Rule object, this will format it and return its string representation suitable for inline use in an HTML element. Slay πŸ’…

my $css = CSS::Object->new(
    debug => 3,
    format => CSS::Object::Format::Inline->new( debug => 3 )
);
my $rule = $css->add_rule( $css->new_rule );
$rule->add_property( $css->new_property(
    name => 'display',
    value => 'none',
));
$rule->add_property( $css->new_property(
    name => 'font-size',
    value => '1.2rem',
));
$rule->add_property( $css->new_property(
    name => 'text-align',
    value => 'center',
));
print( '<div style="%s"></div>', $rule->as_string );

πŸ’¬ comment_as_string

This returns a formatted comment string. Cute, tidy, done πŸŽ€

πŸ“ rule_as_string

This returns a css rule as string. Periodt.


πŸ‘‘ AUTHOR πŸ‘‘

Jacques Deguest <jack@deguest.jp>


🌸 SEE ALSO 🌸

CSS::Object


Copyright (c) 2020 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.


πŸ’– That's the whole page, bestie! This was CSS::Ob...::Inline(3), built with perl v5.42.2 and dated 2026-02-15. Slay and goodbye πŸ¦‹βœ¨

πŸ“¦ where this page comes from