我被要求制作一个表单,通过使用CGI.pm
和表单从用户获得宽度,单位,方向和段落。然后我需要应用宽度,单位和方向的CSS规则的段落。
我想知道是否有可能在Perl中使用CGI.pm
编写内联CSS。
<p style=width:"user-width user-unit";text-align:"user-justification">
paragraph</p>
可以使用-style
参数。
示例:print h1({-style=>'Color: red;'},'Welcome to Hell');
你也可以创建单独的CSS文件。下面是一个使用单独的样式表(style.css)和内联CSS的例子。
print start_html( -title=>'CGI with Style',
-style=>{-src=>'http://www.example.com/style/style.css',
-code=>$newStyle}
);
print h1('CGI with Style'),
p({-class=>'Tip'},
"Better read the cascading style sheet spec before playing with this!"),
span({-style=>'color: magenta'},
"Look Mom, no hands!",
p(),
"Whooo wee!"
);
print end_html;
来源:CGI。点文档