首页 \ 问答 \ 如何在bootstrap中计算推/拉顺序单元?(How I can calculate push/pull order cell in bootstrap?)

如何在bootstrap中计算推/拉顺序单元?(How I can calculate push/pull order cell in bootstrap?)

我尝试命令单元格像图像,这个引导代码是这样做的,但我仍然尝试和测试得到这个顺序,有没有办法计算网格中每个col的推或拉。

我的问题用另一种方式,我需要订购单元格,我可以打印像图像的单元格,即时尝试和测试许多值拉/推得到这个代码..有没有办法计算价值?

<div class="row row-4">
    <div class="col-xs-3 col-md-push-9">5</div>
    <div class="col-xs-4 col-md-push-2">4</div>
    <div class="col-xs-1 col-md-pull-3">3</div>
    <div class="col-xs-3 col-md-pull-7">2</div>
    <div class="col-xs-1 col-md-pull-11">1</div>
</div>

在此处输入图像描述


Im try to order cell like image, and this bootstrap code are do that, but Im still try & test to get this order, is there any way to calculate push or pull for each col in grid .

my question with another way, I need to order cell, to i can print a cell like image, im try & test many of value for pull/push to get this code ..is there way to calculate value?

<div class="row row-4">
    <div class="col-xs-3 col-md-push-9">5</div>
    <div class="col-xs-4 col-md-push-2">4</div>
    <div class="col-xs-1 col-md-pull-3">3</div>
    <div class="col-xs-3 col-md-pull-7">2</div>
    <div class="col-xs-1 col-md-pull-11">1</div>
</div>

enter image description here


原文:https://stackoverflow.com/questions/26337132
更新时间:2022-11-03 13:11

最满意答案

这只是一个猜测,但这是我认为发生的事情:

  • 当您宣布Superhero ,您声明namepower应该具有相同的生命周期。
  • r的类型被推断为&String (或者可能是&str ,点是r是引用)。 在词汇生命周期中, r必须存活到声明它的块的末尾,所以直到第14行。
  • 因为你影响了hero.namerhero.name应该至少与r一样长,因此hero.name应该存在直到第14行。
  • 由于hero.namehero.power应该具有相同的结构声明生命周期,因此hero.power也应该存在直到第14行。
  • 由于hero.power借用了pp应该一直存在到第14行,但它只能存在到声明它的块的末尾(第13行)。

它适用于非词汇生命周期的原因是因为编译器注意到你没有在第12行之后使用r ,因此能够相应地缩短生命周期。 请注意, 如果在第13行的右括号后使用r它甚至不能用于nll


This is only a guess, but here is what I think happens:

  • When you declared Superhero, you stated that name and power should have the same lifetime.
  • The type for r is inferred as &String (or maybe &str, the point is that r is a reference). With lexical lifetimes, r must live until the end of the block in which it is declared, so until line 14.
  • Since you affect hero.name to r, hero.name should live at least as long as r, therefore hero.name should live until line 14.
  • Since hero.name and hero.power should have the same lifetime per the struct declaration, hero.power should also live until line 14.
  • Since hero.power borrows p, p should live until line 14, but it only lives until the end of the block in which it is declared (line 13).

The reason it works with non-lexical lifetimes is because the compiler notices that you don't use r after line 12 and is therefore able to shorten the lifetimes accordingly. Note that it doesn't work even with nll if you use r after the closing brace of line 13.

相关问答

更多
  • 《书香永留存》 这是美国作家Justin. B的一篇文章,针对当时邓肯部长提出的淘汰纸质教科书观点进行评判。 文章内容是“身处E时代,莫忘纸张香”。 下面是详细参考,我没有360文库账号不嗯能够复制,你自己看吧。 http://www.360doc.com/content/12/1016/17/5707568_241854668.shtml 原文及译文如下: long live paper by justin b. hollander october 16, 2012 medford, mass. last ...
  • 你是正确的,你不能返回一个比MutexGuard东西的MutexGuard ,因为这会导致一个可能悬空的指针。 但是,将内容包装在Box无济于事! Box是一个拥有的指针,除了参考生命周期之外,重定向的行为类似于包含的值。 毕竟,如果您返回对它的引用,其他人可能会从HashMap删除它并取消分配它。 根据您对参考的要求,我可以考虑几个选项: 而不是Box值,将它们包装在Arc 。 从HashMap获取时,您将克隆Arc ,并且多个引用可以同时存在。 您也可以将MutexGuard与参考一起返回; 看到这个问 ...
  • 字符串需要所有者: fn lyrics_more_bottles(song_template:&mut String, number:i32){ let mut start_bottles = format!("{} bottles", number); // own them as `String` let mut remaining_num = format!("{} bottles", number); let mut template_partials:HashMap<&st ...
  • 我想你错过了Rust的一些关键细节; 有三件事我认为需要处理: 模式如何工作; 不可变( & )和可变( &mut )引用之间的区别; Rust的所有权模式如何工作(因为您的&*box尝试)。 我将首先处理模式部分; 在fn add(mut list: &List, x: uint) ,有两种模式正在使用, mut list和x 。 模式的其他例子是let lhs = rhs;的左侧let lhs = rhs; 以及match表达式的每个分支上的=>之前的位。 这些模式如何有效地应用于通话? 这真的像你这样 ...
  • 我认为虽然盒子内部的价值确实存在的时间与'a'一样长,因为它是Foo的成员,具有完全相同的生命周期。 可以为derp成员分配一个新框,此时旧框将被删除,并且其中的值的生命周期结束。 我认为你想要做的事情在安全的Rust中是不可能的:不支持struct成员之间的交叉引用。 这经常作为一个问题出现,但它只是在语言中没有。 如何初始化相互引用的struct字段 为什么我不能在同一个结构中存储值和对该值的引用? 您可以使用Rc解决此问题,可能与RefCell结合使用。 I think though that the ...
  • 您正在复制输入&str : let get_string = String::from(get_string); 该副本由函数拥有,并在函数完成时被删除,但您也返回一个包含对它的引用的HashMap 。 应该清楚为什么这不起作用。 删除那一行实际上将修复错误,因为您将引用该函数的参数。 You are copying the input &str here: let get_string = String::from(get_string); This copy is owned by the func ...
  • 这只是一个猜测,但这是我认为发生的事情: 当您宣布Superhero ,您声明name和power应该具有相同的生命周期。 r的类型被推断为&String (或者可能是&str ,点是r是引用)。 在词汇生命周期中, r必须存活到声明它的块的末尾,所以直到第14行。 因为你影响了hero.name到r , hero.name应该至少与r一样长,因此hero.name应该存在直到第14行。 由于hero.name和hero.power应该具有相同的结构声明生命周期,因此hero.power也应该存在直到第14 ...
  • 因为Path::new(&x)返回一个&Path ,它从x借用它的内容。 Some(s) => Some(Path::new(&s.clone())), // Type is Option<&Path> // reborrow --------------^ 你真正想要做的是使用PathBuf (相当于Path )。 PathBuf将取得s所有权而不是借用它。 let cfgFilePath = match matches.opt_str("c") { Some(s) => Some(PathBu ...
  • 这就是为什么你不能返回&node : fn create_node(&mut self) -> &Node { let index = self.nodes.len(); let node = Node { id: index }; println!("{}", &node as *const Node); self.nodes.push(node); println!("{}", &self.nodes[index] as *const Node); ret ...
  • 这看起来就像生活中的缺陷使事情变得不那么明显的情况之一。 这是Builder::new的原型 : pub fn new(context: &Context) -> CSemiBox 这可能会让您认为CSemiBox与context的生命周期没有任何关系。 但是CSemiBox的定义有一个生命周期参数: pub struct CSemiBox<'a, D> 据我了解,当函数的输出类型(在本例中为Builder::new )具有生命周期参数时,如果只有一个输入生命周期,则可以省略它。 (生 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)