小编Sup*_*ing的帖子

使宽度与另一个html元素的大小相同

嗨,我有一个下拉按钮,当你将它悬停时,它会删除一些指向页面的链接.我希望这些链接的大小与按钮的宽度相同.

按钮大小是内容宽度的100%,因此它会有所不同.如何使下拉项目的大小与CSS按钮的大小相同?

    <style type="text/css">
      #button {  /* Box in the button */
        display: block;
        width: 190px;
      }

      #button a {
        text-decoration: none;  /* Remove the underline from the links. */
      }
ul
{
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
}
li{
float:left;
list-style-type: none;
}
      #button ul {
        list-style-type: none;  /* Remove the bullets from the list */
      }

      #button .top {
display:block;
width:100%;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase;  /* The button background */
      }

      #button ul li.item {
        display: …
Run Code Online (Sandbox Code Playgroud)

html css hover

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

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

如何停止从C中的文件读取

我只是想读取文件的每个字符并将其打印出来,但是当文件完成阅读时,但我得到了一堆?完成阅读后.我如何解决它?

#include <stdio.h>

int main(void){
    FILE *fr;            /* declare the file pointer */

    fr = fopen ("some.txt", "r");  /* open the file for reading */
        /* elapsed.dta is the name of the file */
        /* "rt" means open the file for reading text */
    char c;
    while((c = getc(fr)) != NULL)
    {
        printf("%c", c);
    }
    fclose(fr);  /* close the file prior to exiting the routine */
    /*of main*/ 


    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c stdio

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

python中的set()运行时

只是想知道set()的查找运行时间是什么?O(1)还是O(n)?

如果我有

x = set()是什么时候的运行时

如果x中的"a":打印一套!

python

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

在C中删除内存

如何删除C中的内存?

例如,我有:

#include<stdlib.h>
#include<stdio.h>

struct list_el {
   int val;
   struct list_el * next;
};

typedef struct list_el item;

void main() {
   item * curr, * head;
   int i;

   head = NULL;

   for(i=1;i<=10;i++) {
      curr = (item *)malloc(sizeof(item));
      curr->val = i;
      curr->next  = head;
      head = curr;
   }

   curr = head;

   while(curr) {
      printf("%d\n", curr->val);
      curr = curr->next ;
   }
}
Run Code Online (Sandbox Code Playgroud)

在我创建项目1 - 10后,如何删除它并确保它不存在于内存中?

c

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

C++中的多维可变大小数组

嗨,我想做这样的事情:

int op(string s1, string s2){
    int x = s1.size();
    int y = s2.size();
    int matrix = new int[x][y]
    /* do stuff with matrix */
}
Run Code Online (Sandbox Code Playgroud)

出于某种原因,我收到以下错误:

SuperString.cpp(69) : error C2540: non-constant expression as array bound
SuperString.cpp(69) : error C2440: 'initializing' : cannot convert from 'int (*)[1]' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
SuperString.cpp(71) : error C2109: subscript requires array or pointer type
Run Code Online (Sandbox Code Playgroud)

谢谢!

c++ arrays

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

在Python中删除字符串中的重复项

删除字符串中所有重复项的有效算法是什么?

例如:aaaabbbccdbdbcd

要求的结果:abcd

python algorithm

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

select_tag rails问题

我有一个select_tag,就像这样:选择一些东西1东西2 ......

在我选择了2并点击提交按钮后,它会刷新页面,但是在select_tag上显示再次选择某个内容.我怎样才能让它显示2?

ruby-on-rails

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

html提交链接

我想创建一个提交链接而不是一个提交按钮。

它看起来像任何普通的链接(蓝色和下划线),当你点击它时,表单被提交。

编辑:是否可以在没有 javascript/jquery 的情况下做到这一点?

html

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

这个lseek,fseek,read,fread之间的区别是什么?

我在调用这些函数:

unsigned blah[5];
lseek(0, 100, SEEK_CUR);
read(0, blah, sizeof(blah));
Run Code Online (Sandbox Code Playgroud)

FILE *fr;
fr = fopen(arg[1], "r");
unsigned blah[5];
fseek(fr, 100, SEEK_CUR);
fread(blah, 1, sizeof(blah), fr);
Run Code Online (Sandbox Code Playgroud)

我运行第一个代码运行此命令:

cat TEXTFILE | ./a.out
Run Code Online (Sandbox Code Playgroud)

我运行第二个代码运行此命令:

./a.out TEXTFILE
Run Code Online (Sandbox Code Playgroud)

但是,我得到了不同的结果.虽然第一个搜索正确,所以它读取正确的文本,第二个不是.我想使用第二种格式,那么我做错了什么?

c

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

标签 统计

c ×3

html ×2

python ×2

algorithm ×1

arrays ×1

c++ ×1

css ×1

hashmap ×1

hover ×1

ruby-on-rails ×1

stdio ×1