HTML / CSS图标定位问题

时间:2016-03-24 17:52:52

标签: css

有人可以帮我定位图标..我有这个

enter image description here

并且需要从中做出这个

enter image description here

2 个答案:

答案 0 :(得分:1)

在这些情况下,您应该发布链接到plunker或其他东西以获得更好的帮助。没有代码就很难回答,但我会尝试。您的HTML应该如下所示

<div class="item"><span class="icon">Your icon goes here</span><span class="text">Text near icon</span></div>
<div class="item"><span class="icon">Your icon goes here</span><span class="text">Text near icon</span></div>
<div class="item"><span class="icon">Your icon goes here</span><span class="text">Text near icon</span></div>
...

您的CSS应如下所示:

.item {
    display: inline-block;
    width: 33%;
}
.icon {
    display: inline-block;
    margin: 0 15px 15px 0;
}

答案 1 :(得分:0)

你可以通过两种方式实现

  1. https://jsfiddle.net/LzgfLaxr/

  2. 1
  3. 1
  4. 1
  5. 1
  6. 1
  7. 1
  8. 1
  9. 1
  10. 1
  11. CSS

    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    
    struct PROMPTFLAGS {
        int help;    // Change from NULL if -h argument present
        char * outputFile;    // Store argument after -o as the output file
        char * inputFile;    // Argument not paired with a flag stored here as input file
        float threshold;    // Stores a value to use in image manipulation in main
    };
    
    struct PROMPTFLAGS * parsargs(int argc, char * argv[]) {
        struct PROMPTFLAGS* flag = malloc(sizeof(struct PROMPTFLAGS));
        int i;
        printf("argc: %d\n",argc);
        for (i = 1; i < argc; i++) {
            char * arg = argv[i];
            int str_aft = i+1;    // Allows the next string to be used in this iteration of the loop
            if (strcmp(arg,"-h") == 0) {
                flag->help = 1;
            }
            if (strcmp(arg,"-o") == 0) {    // Changing this to 'else if' seems to be a fix
                flag->outputFile = argv[str_aft];
                i++;        // Skips over next arg since already read by argv[str_aft]
            }
            if (strcmp(arg,"-t") == 0) {    // Changing this to 'else if' seems to be a fix
                flag->threshold = strtod(argv[str_aft],NULL);
                i++;        // Skips over next arg since already read by argv[str_aft]
            }
            else {
                flag->inputFile = arg;
            }
        }
        return flag;
    }
    
    int main(int argc, char* argv[]) {
    
        struct PROMPTFLAGS * flags;
        flags = parsargs(argc, argv);
        printf("Help = %d\n",flags.help);
        printf("Output = %s\n",flags.outputFile);
        printf("Input = %s\n",flags.inputFile);
        printf("Threshold = %s\n",flags.threshold);
    
    return 0;
    }
    
    1. https://jsfiddle.net/z7cqL7he/(排列将响应屏幕宽度)

    2. CSS

      .grp1{
        float:left;
      }