小编Igo*_*cha的帖子

中间和中间div

我在中间对齐了一个徽标,当我调整屏幕/窗口宽度时,它完美地保持在中心位置.在徽标的左边我有一个只有两个单词的小菜单,我希望这个菜单/ div始终位于徽标和左边缘之间.

这可以用CSS完成吗?

要考虑的是徽标有自己的widht,200px但我可以解决这个问题margin-left: -100px;.当它的屏幕尺寸不再适合左边时!我会把它放在徽标下面@media screen and (max-width: px) { ... }.

像这样:http://postimg.org/image/v148gyc9b/

html css center alignment

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

如何调整Bootstrap DatePicker的大小?

我的代码是这样的:

HTML:

<div class="input-append date datepicker no-padding" data-date-format="dd-mm-yyyy">
    <input class="input-medium" size="16" type="text"><span class="add-on"><i class="icon-th"></i></span>
</div>
Run Code Online (Sandbox Code Playgroud)

Javascript:

$(document).ready(function() {
    $('.datepicker').datepicker({
        autoclose: true,
        startDate: new Date()
    });
});
Run Code Online (Sandbox Code Playgroud)

演示:jsfiddle

我想改变bootstrap datepicker的大小

任何解决我的问题的建议

谢谢

css jquery datepicker twitter-bootstrap

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

我可以将CSS背景定位到"底部减去x像素"吗?

我需要将我的背景放在屏幕的底部.但在移动设备分辨率上,我希望将其显示为低于100px,例如"bottom minus 100px".是否可以在CSS中实现这样的功能?

css position background-position

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

Bootstrap网格 - 更改移动设备中的顺序

我有四个.col-md-6div的bootstrap行.正常的屏幕显示为这样的两个部分.

在此输入图像描述

当您切换到移动设备时,它会将其顺序更改为单个列(在每个div下显示4个div).我使用了两种颜色的div.第一个div有白色背景颜色,第二个div有黑色背景颜色.让我们看看它在移动设备上的样子.第一行第二个div有一个黑色背景,第二行第一个div有一个黑色背景所以它显示两个黑色背景颜色div合并方式!我该如何解决这个问题,还是有任何可用的boostrap pull push方法来做这样的事情?

在此输入图像描述

html css twitter-bootstrap twitter-bootstrap-3

3
推荐指数
1
解决办法
484
查看次数

我需要将<div>置于<td>中心

我需要居中<div>,<td>因为现在(用我的代码)我看到右边的div但我想看到div的中心<td>.这是我的代码:

<table width="100%">
  <tbody>
    <tr>
      <td>
        <div>
          <label>Start date</label>
          <br/>
          <input type="date" name="start_date">
        </div>
      </td>
      <td>
        <div>
          <label>End date</label>
          <br/>
          <input type="date" name="end_date">
        </div>
      </td>
    </tr>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

有人可以帮帮我吗?我不知道我怎么能这样做.

html css

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

背景:和背景图像之间的差异:

快速简单的问题在下面的外部CSS页面示例中;

body {
  background-image: url(background.jpg);
}
header {
  background: url(background.jpg);
}
Run Code Online (Sandbox Code Playgroud)

我知道他们正在影响不同的元素选择器,我的问题是使用背景与背景图像有什么区别?是否可以访问另一个特定属性?谢谢,麻烦您了.

css background between background-image difference

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

验证失败:密码不能为空

我有一个应用程序,基于Rails 4.2,并尝试使用Twitter进行身份验证RailsCasts #241 Simple OmniAuth.
但是有这个问题:Validation failed: Password can't be blank!
我到处搜索答案,但没有找到解决方案!

user.rb

class User < ActiveRecord::Base

    has_secure_password
    validates :password, length: { minimum: 6 }, allow_blank: true
    def self.create_with_omniauth(auth)
        create! do |user|
            user.provider = auth.provider
            user.uid = auth.uid
            user.name = auth.info.name
        end
    end
end
Run Code Online (Sandbox Code Playgroud)

sessions_controller.rb

class SessionsController < ApplicationController
   def login
   end

   def create
       @user = User.find_by_email(params[:email])
       if @user && @user.authenticate(params[:password])
           session[:user_id] = @user.id
           redirect_to root_path
       else
           redirect_to :back
       end
   end

   def create_session
       auth = request.env['omniauth.auth']
       user …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails omniauth ruby-on-rails-4.2 omniauth-twitter

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

Bootstrap Modal 中带有缩略图的滑动器

我尝试将带有缩略图的 swiper 库添加到引导模式,但在模式中它不起作用,为什么?(我直接使用文档中的滑块代码)

这是演示: http: //codepen.io/vertisan/pen/MyBdKz

模态:

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">

        <div class="swiper-container gallery-top">
          <div class="swiper-wrapper">
            <div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/1)"></div>
            <div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/2)"></div>
            <div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/3)"></div>
          </div>
        </div>
        <div class="swiper-container gallery-thumbs">
          <div class="swiper-wrapper">
            <div class="swiper-slide" style="background-image:url(http://lorempixel.com/400/400/nature/1)"></div>
            <div class="swiper-slide" style="background-image:url(http://lorempixel.com/400/400/nature/2)"></div>
            <div class="swiper-slide" style="background-image:url(http://lorempixel.com/400/400/nature/3)"></div>
          </div>
        </div>

      </div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

JS:

var galleryTop = new Swiper('.gallery-top', {
  spaceBetween: 10, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap

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

如何更改字体真棒图标悬停颜色?

目前我的HTML看起来像这样:

<div class="col-md-4 text-center">
  <i class="fa fa-2x fa-facebook wow bounceIn social"></i>
  <i class="fa fa-2x fa-twitter wow bounceIn social"></i>
  <i class="fa fa-2x fa-google-plus wow bounceIn social"></i>
</div>
Run Code Online (Sandbox Code Playgroud)

我尝试了以下CSS,没有发生任何事情:

fa-facebook:hover {
  color: #006b33;
}
Run Code Online (Sandbox Code Playgroud)

我对字体非常棒,所以任何帮助都将不胜感激!

html css font-awesome

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

使用document.getElementsByClassName添加css类

我正在尝试使用javascript添加css类但它无法正常工作

var x = document.getElementsByClassName('oldclassname');
var i;
for (i = 0; i < x.length; i++) {
  x[i].className += 'newclassname';
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试改变背景时它起作用

var x = document.getElementsByClassName("oldclassname");
var i;
for (i = 0; i < x.length; i++) {

  x[i].style.backgroundColor = "red";
}
Run Code Online (Sandbox Code Playgroud)

我在添加css文件时做错了什么

javascript css

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