小编Naï*_*ier的帖子

使用Bootstrap将行内联元素连接起来

我正在使用Bootstrap 3设计我的网站,我想在div中水平放置文本输入和3个按钮.这是我的标记:

<div style="width: 400px">
  <input class="form-control" type="text">
  <a class="btn" href="#">Button 1</a>
  <a class="btn" href="#">Button 2</a>
  <a class="btn" href="#">Button 3</a>
</div>
Run Code Online (Sandbox Code Playgroud)

但是文本输入跨越整个div的宽度,按钮被推到它下面.

我已经尝试将文本输入的显示模式设置为inline,inline-block但它没有改变任何东西.

救命?

html css twitter-bootstrap

6
推荐指数
2
解决办法
3万
查看次数

如何转义 Makefile 中的空格

假设我想将位于 中的 C++ 项目编译为/home/me/Google Drive/Foobar/名为 的可执行文件Foobar,并且我想使用 GNU Make 以使该过程自动化。

这是我的 Makefile 的样子:

OUTPUT = $(notdir $(CURDIR))

all $(OUTPUT):
    g++ *.cpp -o $(OUTPUT)
Run Code Online (Sandbox Code Playgroud)

问题是,由于项目路径中有空格,因此该notdir命令正在解释两个单独的路径并返回Google Foobar

我试过在$(CURDIR)( $(notdir "$(CURDIR)"))周围加上引号,但出现以下错误:

/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud)

我不明白问题出在哪里。

另外,我希望得到一个不涉及更改路径名的答案......谢谢:)

makefile escaping

5
推荐指数
1
解决办法
4530
查看次数

RegEx用于选择路径的第一个元素

我的问题非常简单,我想编写一个这样做的RegEx:

/ -> /

/foo -> /foo

/foo/bar -> /foo

/foo/bar/baz -> /foo

我试过这个:

replace(/(\/[^\/]*)\/[^\/]*/, '$1')

但它返回路径,未经修改.

有谁知道怎么办?

regex path

4
推荐指数
1
解决办法
2846
查看次数

使用Express'路径路径匹配`/`和`/ index`

我正在使用Express,我希望匹配//index使用相同的路线.但如果我写

app.route('/(index)?')
Run Code Online (Sandbox Code Playgroud)

节点抛出此错误:

c:\myproject\node_modules\express\node_modules\path-to-regexp\index.js:69
  return new RegExp(path, flags);
         ^
SyntaxError: Invalid regular expression: /^\/(?(?:([^\/]+?)))?e\/?$/: Invalid group
    at new RegExp (native)
    at pathtoRegexp (c:\myproject\node_modules\express\node_modules\path-to-regexp\index.js:69:10)
    at new Layer (c:\myproject\node_modules\express\lib\router\layer.js:32:17)
    at Function.proto.route (c:\myproject\node_modules\express\lib\router\index.js:482:15)
    at EventEmitter.app.route (c:\myproject\node_modules\express\lib\application.js:252:23)
    at c:\myproject\server.js:28:19
    at Array.forEach (native)
    at Object.<anonymous> (c:\myproject\server.js:27:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
Run Code Online (Sandbox Code Playgroud)

请注意,如果我使用

app.route('/foo(bar)?')
Run Code Online (Sandbox Code Playgroud)

它工作正常......

javascript regex path node.js express

2
推荐指数
1
解决办法
1729
查看次数