CSS::Ob...::Inline(3)
π 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 & LICENSE π
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
- alpine 3.24: perl-css-object-doc 0.2.0-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms