id里面的css div class(css div class inside id)
我在使用我的CSS页面时遇到问题,它应该是一个几乎是白色的背景,它不会在我的课堂上显示。 我的代码:
<div id="content"> <?php $query="SELECT * FROM softwares ORDER BY Idsoft DESC LIMIT 5"; $result=mysqli_query($ligabd,$query); while ($rows=mysqli_fetch_array($result)) { $id=$rows["Idsoft"]; $a1=$rows["nome"]; $a2=$rows["marca"]; $a3=$rows["preco"]; $a4=$rows["stock"]; $a5=$rows["img"]; ?> <div class="img"> <a href="productprofile.php?id=<?php echo $id; ?>"> <img src="<?php echo $a5;?>" width="110" height="90"> <div class="desc"><?php echo "".$a2." - ".$a1.""?></div> </a> </div> <?php } ?> </div>
在这里我的css:
#content { width: 500px; width: 80%; height:1000; margin: 0 auto 0 auto; background-color:#999 overflow:hidden; background-size:1980px 1080px; }
并为图像拼贴:
div.img { margin:5px; padding: 5px; border:1px solid #0000ff; height:auto; width:auto; float:left; text-align:center; } div.img img { display:inline; margin:5px; border:1px solid #ffffff; } div.img a:hover img { border:1px solid #0000ff; } div.desc { text-align:center; font-weight:normal; width:120px; margin:5px; }
我的问题是内容中的背景应该出现在类下面,但我不能使它工作,已经尝试过而不是使用一个使用id的类但我不能格式化。 谁会帮助我,我将不胜感激!
i'm having problems using my css page, where it should be a almost white background it doesnt show in my class. my code:
<div id="content"> <?php $query="SELECT * FROM softwares ORDER BY Idsoft DESC LIMIT 5"; $result=mysqli_query($ligabd,$query); while ($rows=mysqli_fetch_array($result)) { $id=$rows["Idsoft"]; $a1=$rows["nome"]; $a2=$rows["marca"]; $a3=$rows["preco"]; $a4=$rows["stock"]; $a5=$rows["img"]; ?> <div class="img"> <a href="productprofile.php?id=<?php echo $id; ?>"> <img src="<?php echo $a5;?>" width="110" height="90"> <div class="desc"><?php echo "".$a2." - ".$a1.""?></div> </a> </div> <?php } ?> </div>
and here my css:
#content { width: 500px; width: 80%; height:1000; margin: 0 auto 0 auto; background-color:#999 overflow:hidden; background-size:1980px 1080px; }
and for the image tiles:
div.img { margin:5px; padding: 5px; border:1px solid #0000ff; height:auto; width:auto; float:left; text-align:center; } div.img img { display:inline; margin:5px; border:1px solid #ffffff; } div.img a:hover img { border:1px solid #0000ff; } div.desc { text-align:center; font-weight:normal; width:120px; margin:5px; }
my problem is that the background in the content should appear under the class, but i cant make it work, already tried to instead of using a class using an id but i cant format. i'll be appreciated by who helped me!
原文:
更新时间:2022-06-05 22:06
最满意答案
简单
- 在
O(n)
时间内创建一个概率数组(总和为1.0)- 生成介于0.0和1.0之间的随机数
- 在
O(n)
时间内遍历数组:
- 如果随机数<元素的概率,停止
- 否则按概率递减随机数并移动到下一个元素
- 答案是与您停在的元素对应的数字
复杂
- 在
O(n)
时间内创建一个累积概率数组并将它们存储在一个数组中(此数组应具有增加的值)- 生成介于0.0和1.0之间的随机数
- 进行二进制搜索以在
O(log(n))
时间内找到>=
随机数的最小元素。- 答案是与您停在的元素对应的数字
我没有提供必要的角落案件来解决。 我相信你可以自己做。
Simple
- Create an array of probabilities (sum to 1.0), in
O(n)
time- Generate a random number between 0.0 and 1.0
- Iterate through the array, in
O(n)
time:
- if the random number < the probability of the element, stop
- otherwise decrement the random number by the probability and move to next element
- The answer is the number corresponding to the element you stopped at
Complex
- Create an array of cumulative probabilities and store them in an array, in
O(n)
time (this array should have increasing values)- Generate a random number between 0.0 and 1.0
- Do a binary search to find the smallest element that is
>=
the random number, inO(log(n))
time.- The answer is the number corresponding to the element you stopped at
I have not included the necessary corner cases to address. I am sure you can do it yourself.
相关问答
更多-
这是一个具有以下逻辑的解决方案: 最多生成3个故障,随机分配 确定步骤2中有多少故障 给先前的失败更多的机会再次失败 请注意,我认为它同样可能有0,1,2或3次失败。 nRuns = 5; allRuns = zeros(nRuns,10); %# stores success and failure for all runs %# (1) generate from 0 to 3 failures (each outcome is equally likely) nFailures = randi([0 ...
-
随机概率选择(Random Probability Selection)[2023-01-21]
我已经考虑了这个,并提出了以下建议。 我们可以让第一个人获得公平的胜利,然后如果剩下的奖励在其他人中公平分配(无论他是赢还是输),整个事情都是公平的。 当然,这远非正式证据,所以请随意纠正我。 以下应该给出一个公平的系统: int prizes = 10; for(int i = 100; i >= 1; i++) { var result = random.Next(people); if(result < prizes) { Console.WriteLine("{0} won", ... -
如果使用set ,代码更简单。 import random def noncontiguoussample(n,k): numbers = set(range(1,n+1)) samples = [] for _ in range(k): v = random.choice(list(numbers)) samples.append(v) numbers -= set([v-1, v, v+1]) return samples ...
-
在内置random模块的文档末尾描述了一些很好的方法来进行加权随机选择: 一个常见的任务是用加权概率做一个random.choice()。 如果权重是小整数比率,一种简单的技术是构建具有重复的样本总体: >>> weighted_choices = [('Red', 3), ('Blue', 2), ('Yellow', 1), ('Green', 4)] >>> population = [val for val, cnt in weighted_choices for i in range(cnt)] ...
-
选择概率随机条目(Select random entry with probability)[2022-04-19]
基于处理整个用户和点的地图,可能存在许多类似的方法。 这很简单,如果没有很多用户可以正常工作。 但是当用户数量增长时,内存甚至CPU使用率可能会出现很大的性能问题。 因此,我考虑了考虑性能的可能解决方案。 这里描述了我将根据概率绘制用户的方法: +------+--------+ | User | Points | Bar graph: +------+--------+ | A | 20 | |~~~~~~~~~~~~~~~~~~~~| +------+--------+ | ... -
嗯,使用你的原始我有一个非常简单的算法,以适当的比例生成数组中的范围,然后随机选择一个范围并生成该范围内的随机数。 毫无疑问,如果有必要,它可以进行优化,但它对我有用。 它看起来像很多代码,但它的3/4是注释,测试数据和函数,实际的randomRange函数只有17行代码。