Config distance between to cards

Hello,
I have combined several cards into a grid.
This is my code:

square: false
columns: 1
type: grid
cards:
  - type: markdown
    content: |
      {% set time = now().hour %} 
      {% if (time >= 23) %} # Noch wach {{user}} ?
      {% elif (time >= 22) %} # Gute Nacht {{user}} 
      {% elif (time >= 17) %} # Guten Abend {{user}} 
      {% elif (time >= 10) %} # Guten Tag {{user}} 
      {% elif (time >= 6) %} # Guten Morgen {{user}} 
      {% else %} # Hallo {{user}} {% endif %}
    card_mod:
      style: |
        ha-card {
          background: none;
          box-shadow: none;
          text-align: center
        }
  - type: markdown
    content: >
      <font color="#9b9b9b">Heute ist der {{ now() | as_timestamp |
      timestamp_custom("%d.%m.%Y") }}

      Draußen ist es {{ states('weather.openweathermap') |

      replace("sunny", "sonnig") | replace("rainy", "regnerisch") |

      replace("partlycloudy", "teilweise bewölkt") | replace("cloudy",

      "bewölkt") | replace("clear-night", "eine klare Nacht") |

      replace("fog", "neblig") }}

      bei {{ states('sensor.netatmo_haus_buro_og_aussen_og_temperature') 

      | replace(".", ",") }} °C, {{
       states('sensor.netatmo_haus_buro_og_aussen_og_humidity')  |
      replace(".", ",") }}% Luftfeuchtigkeit und {{

      (states('sensor.openweathermap_wind_speed') | float*3.6) | round(0)

      | replace(".", ",") }} km/h Wind</font>
    card_mod:
      style: |
        ha-card {
          background: none;
          box-shadow: none;
          text-align: center
        }
  - square: false
    columns: 2
    type: grid
    cards:
      - type: custom:mushroom-chips-card
        chips:
          - type: template
            card_mod:
              style: |
                ha-card {
                  {% set phase = states('sensor.moon') %}
                  --chip-background: url( '/local/moon_phases/{{ phase }}.png?v=1' ) no-repeat center center;
                }
      - type: markdown
        content: |-
          <font color="#9b9b9b">{{ states('sensor.moon') | replace("new_moon",
          "Neumond") | replace("full_moon", "Vollmond") |
          replace("first_quarter", "zunehmender Halbmond") |
          replace("last_quarter", "abnehmender Halbmond") |
          replace("waning_crescent", "Abnehmender Sichelmond") |
          replace("waning_gibbous", "abnehmender Dreiviertelmond") |
          replace("waxing_crescent", "zunehmender Sichelmond") |
          replace("waxing_gibbous", "zunehmender Dreiviertelmond") }}</font>
        card_mod:
          style: |
            ha-card {
              background: none;
              box-shadow: none;
            }
  - type: markdown
    content: >

      <font color="ember"><ha-icon
      icon="mdi:weather-sunset-up"></ha-icon></font> <font color="#9b9b9b">{{
      as_timestamp(state_attr("sun.sun",

      "next_rising")) |timestamp_custom("%H:%M:%S") }}</font> <font
      color="red"><ha-icon icon="mdi:weather-sunset-down"></ha-icon></font>
      <font color="#9b9b9b">{{ as_timestamp(state_attr("sun.sun",

      "next_setting")) |timestamp_custom("%H:%M:%S") }} </font>
    card_mod:
      style: |
        ha-card {
          background: none;
          box-shadow: none;
          text-align: center
        }

how can i reduce the distance between the individual cards?

This is how it looks at the moment:

If you want a single column, use vertical-stack instead of grid.

ok, now I try it with vertical-stack, but its the same:

This now my code:

type: vertical-stack
cards:
  - type: markdown
    content: |
      {% set time = now().hour %} 
      {% if (time >= 23) %} # Noch wach {{user}} ?
      {% elif (time >= 22) %} # Gute Nacht {{user}} 
      {% elif (time >= 17) %} # Guten Abend {{user}} 
      {% elif (time >= 10) %} # Guten Tag {{user}} 
      {% elif (time >= 6) %} # Guten Morgen {{user}} 
      {% else %} # Hallo {{user}} {% endif %}
    card_mod:
      style: |
        ha-card {
          background: none;
          box-shadow: none;
          text-align: center
        }
  - type: markdown
    content: >
      <font color="#9b9b9b">Heute ist der {{ now() | as_timestamp |
      timestamp_custom("%d.%m.%Y") }}

      Draußen ist es {{ states('weather.openweathermap') |

      replace("sunny", "sonnig") | replace("rainy", "regnerisch") |

      replace("partlycloudy", "teilweise bewölkt") | replace("cloudy",

      "bewölkt") | replace("clear-night", "eine klare Nacht") |

      replace("fog", "neblig") }}

      bei {{ states('sensor.netatmo_haus_buro_og_aussen_og_temperature') 

      | replace(".", ",") }} °C, {{
       states('sensor.netatmo_haus_buro_og_aussen_og_humidity')  |
      replace(".", ",") }}% Luftfeuchtigkeit und {{

      (states('sensor.openweathermap_wind_speed') | float*3.6) | round(0)

      | replace(".", ",") }} km/h Wind</font>
    card_mod:
      style: |
        ha-card {
          background: none;
          box-shadow: none;
          text-align: center
        }
  - square: false
    columns: 2
    type: grid
    cards:
      - type: custom:mushroom-chips-card
        chips:
          - type: template
            card_mod:
              style: |
                ha-card {
                  {% set phase = states('sensor.moon') %}
                  --chip-background: url( '/local/moon_phases/{{ phase }}.png?v=1' ) no-repeat center center;
                }
      - type: markdown
        content: |-
          <font color="#9b9b9b">{{ states('sensor.moon') | replace("new_moon",
          "Neumond") | replace("full_moon", "Vollmond") |
          replace("first_quarter", "zunehmender Halbmond") |
          replace("last_quarter", "abnehmender Halbmond") |
          replace("waning_crescent", "Abnehmender Sichelmond") |
          replace("waning_gibbous", "abnehmender Dreiviertelmond") |
          replace("waxing_crescent", "zunehmender Sichelmond") |
          replace("waxing_gibbous", "zunehmender Dreiviertelmond") }}</font>
        card_mod:
          style: |
            ha-card {
              background: none;
              box-shadow: none;
            }
  - type: markdown
    content: >

      <font color="ember"><ha-icon
      icon="mdi:weather-sunset-up"></ha-icon></font> <font color="#9b9b9b">{{
      as_timestamp(state_attr("sun.sun",

      "next_rising")) |timestamp_custom("%H:%M:%S") }}</font> <font
      color="red"><ha-icon icon="mdi:weather-sunset-down"></ha-icon></font>
      <font color="#9b9b9b">{{ as_timestamp(state_attr("sun.sun",

      "next_setting")) |timestamp_custom("%H:%M:%S") }} </font>
    card_mod:
      style: |
        ha-card {
          background: none;
          box-shadow: none;
          text-align: center
        }

Could you send a screenshot of what it looks like without your card-mod styling?

yes, than it looks like:

You should be able to modify padding and margin with theming variables.

yes, but I don´t know how

Untested:

ha-card {
  padding: 0;
}

per card

ha-card {
  --horizontal-stack-card-margin: 0;
}

for the whole stack

I`m not sure, where to put this to codes on my code

card-mod thread → 1st post → link at the bottom → styles for vertical-stack

I think you mean this:

But I don´t know to add or modify my code.