绝对位置,但相对于父母(Position absolute but relative to parent)
我在另一个div里面有两个div,我想把一个小孩div定位到父div的右上方,另一个孩子使用css将父div定位到父div的底部。 也就是说,我想使用两个子div的绝对定位,但是相对于父div而不是页面。 我该怎么做?
示例html:
<div id="father"> <div id="son1"></div> <div id="son2"></div> </div>
I have two divs inside another div, and I want to position one child div to the top right of the parent div, and the other child div to the bottom of the parent div using css. Ie, I want to use absolute positioning with the two child divs, but position them relative to the parent div rather than the page. How can I do this?
Sample html:
<div id="father"> <div id="son1"></div> <div id="son2"></div> </div>
原文:https://stackoverflow.com/questions/10487292
最满意答案
$ perl -E "say join ', ', @ARGV" -- -1 2 3 -1, 2, 3
诀窍是使用双连字符(
--
)来结束选项解析。 双连字符是GNU惯例 :$ touch -a usage: touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ... $ touch -- -a $ ls -a
$ perl -E "say join ', ', @ARGV" -- -1 2 3 -1, 2, 3
The trick is using the double-hyphen (
--
) to end the option parsing. Double-hyphen is a GNU convention:$ touch -a usage: touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ... $ touch -- -a $ ls -a
相关问答
更多-
您应该根据变量的内容构建命令字符串 像这样 my $var1 = $john; my $var2 = $doe; my $command = "/path/to/tool/tool --in $line --out $outputdir"; $command .= " $var1" if defined $var1; $command .= " --text $var2" if defined $var2; execute($command); 也 当你调用Perl子程序时,不要使用&符 ...
-
我如何让Perl接受负数作为命令行参数?(How can I get Perl to accept negative numbers as command-line arguments?)[2022-11-29]
$ perl -E "say join ', ', @ARGV" -- -1 2 3 -1, 2, 3 诀窍是使用双连字符( -- )来结束选项解析。 双连字符是GNU惯例 : $ touch -a usage: touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ... $ touch -- -a $ ls -a $ perl -E "say join ', ', @ARGV" -- -1 2 3 -1, 2, 3 The trick is ... -
取决于你想做什么 如果要使用两个参数作为输入文件,可以将它们传入,然后使用<>读取其内容。 如果他们有不同的含义,可以使用GetOpt::Std和GetOpt::Long来轻松处理它们。 GetOpt::Std只支持单字符开关, GetOpt::Long更灵活。 来自GetOpt::Long : use Getopt::Long; my $data = "file.dat"; my $length = 24; my $verbose; $result = GetOptions ("length=i" = ...
-
你应该将每个参数都转换为int 。 但是,如果参数不可解析,它可能会引发异常。 试试这种方式: import sys args = sys.argv[1:] parsed_args = [] for a in args: try: parsed_args.append(int(a)) except ValueError: print 'Not able to parse %s to int' % a print parsed_args 这样你可以处理 ...
-
答:冒号)可以用来表示可选的选项: #!/usr/bin/env perl use strict; use warnings; use Getopt::Long; my ( $zip, $help, $input_dir, $output_dir ); GetOptions( 'z:s' => \$zip, 'h' => \$help, 'in=s' => \$input_dir, 'out=s' => \$output_dir, ); A : (co ...
-
“命令行参数”仅在从URL运行时与ClickOnce应用程序一起使用。 例如,这是您应该如何启动应用程序以附加一些运行时参数: HTTP://myserver/install/MyApplication.application参数1 =值1&参数2 =值2 我有以下用于解析ClickOnce激活URL和命令行参数的C#代码: public static string[] GetArguments() { var commandLineArgs = new List
(); st ... -
你应该使用GetOpt::Long 。 这将完成您所需要的所有功能。 You should be using GetOpt::Long. This will do everything you need as described.
-
使用命令行参数解析库(如OptionParser)可以轻松完成此操作。 require 'optparse' LOG_LEVELS = ['DEBUG', 'INFO ', 'WARN ', 'ERROR', 'FATAL'] def error_sort(log_file) LOG_LEVELS.each do |log_level| File.readlines(log_file).each do |line| if (line =~ /<#{log_level}>/ .. ...
-
只需在循环中的printf语句之前添加此条件 if(argv[i][0] == '-') { printf("Sorry, you have negative value. \n"); exit (0); } Just add this condition before printf statement in the loop if(argv[i][0] == '-') { printf("Sorry, you have negative value. \n"); ...
-
来自http://answers.oreilly.com/topic/419-convert-binary-octal-and-hexidecimal-numbers-in-perl/ : print "Gimme an integer in decimal, binary, octal, or hex: "; $num =
; chomp $num; exit unless defined $num; $num = oct($num) if $num =~ /^0/; # catches 0 ...