我想把两个盒子放在一起,但到目前为止第二个对象总是在第一个对象之下。这是我从 getbootstrap.com 使用的代码。
我只需要像这样的盒子,彼此之间的nexto不是在不同的线上。注意:我已尝试在CSS中使用它
float: left;
遗憾的是没有发生任何好事。
<div class="row">
<div class="col-xs-6 col-md-3">
<a href="#" class="thumbnail">
<img src="..." alt="...">
</a>
</div>
</div>
答案 0 :(得分:1)
看来你只有一个盒子。您应该阅读twitter引导网格背后的列概念:http://getbootstrap.com/css/#grid-intro。
我假设您正在尝试为移动设备和桌面设备添加混合行为(通过混合不同单元大小的col-xs和col-md)。
<!-- Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop -->
<div class="row">
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
<!-- Columns are always 50% wide, on mobile and desktop -->
<div class="row">
<div class="col-xs-6">.col-xs-6</div>
<div class="col-xs-6">.col-xs-6</div>
</div>
.col-xs-12 .col-md-8 .col-xs-6 .col-md-4
%This is the number of bits
m=1000;
%This is a counter needed for the probability calculation
count=0;
%Loop needed for the probability calculation
for i = 1:1000000
%This is a random number generator that generates m (1000 in this case)
%random numbers between 0 and 1
randomseq=rand(1,m);
%This creates a random number between 0 and 1 and then multiplies it by
%0.29 so it can actually be between 0 and 0.29. If n is not a random
%number, then change it with the fixed value that it has.
n=rand(1,1)*0.29;
%This line is for the following:
%If a number is less than n, then make it 1, else make it 0 (this is
%needed so you can acquire a probability for the number of ones and the
%number of zeros). Here you will have around n*1000 ones, but not
%equal since randomseq is a random vector with 1000 elements and those
%are too few numbers so it can create a real distribution.
onezerorand=randomseq<n;
%That's why this is needed, just in case if the number of ones go over
%30%. If it goes over 30%, than make the numones coef 0.29
if sum(onezerorand)>=300
numones=0.29;
else
%This is a coef which represent the number of ones, but in probability
%terms (between 0 and 1). Mean just calculates the mean value between
%the zeros and the ones, which is essentially the probability.
numones=mean(onezerorand);
end
%The rest of the numbers are zero, so you get the probability by
%subtracting numones from 1
numzeros=1-numones;
%This creates a random number x between 0 and 0.59. If x is not a
%random number, the same comment goes as for n.
x=rand(1,1)*0.59;
%There is a 50% chance that x of the ones will be changed to zeros and
%vice versa, so you create a random number between 0 and 0.5 and
%multiply it by x.
p0=rand(1,1)*0.5;
p1=1-p0;
x_ones=rand(1,1)*p0*x;
x_zeros=rand(1,1)*p1*x;
%You add the changed zeros to the ones and the changed ones to the
%zeros and you subtract the changed ones from the ones and the changed
%zeros from the zeros, so you can get the last value of the number of
%zeros.
new_numones=numones-numones*x_ones+numzeros*x_zeros;
new_numzeros=numzeros-numzeros*x_zeros+numones*x_ones;
%You create a random number between 0.51 and 0.99, so you can compare
%the number of zeros to it. If q is not a random number, the same
%comment as the one for x and n.
q=rand(1,1)*0.48+0.51;
%You compare the number of zeros to the new random number. If it's
%bigger than it, than you raise the counter, if not, you do nothing.
%You repeat this 1000000 times so you can get a good probability
%estimation and the number you get is the probability of this occuring.
if new_numzeros>q
count=count+1;
end
end
%The probability of this event occuring
prob=count/1000000;
答案 1 :(得分:0)
我认为你正在寻找类似的东西 http://www.layoutit.com/build
numbers[i+2]