• Hoppa till huvudinnehåll
  • Skip to header right navigation
  • Skip to site footer
WP Akuten

WP Akuten

Ta det lugnt - det ordnar sig

  • Verktyg
  • Tips
  • Felsökning
  • Plugin
  • Utveckling
  • Blogg
  • Boka support
    • Kontakta WP-akuten/KoBoToLo
    • Pro bono
    • Integritestpolicy
Boka ett möte
Ring
Sök
  • Verktyg
  • Tips
  • Felsökning
  • Plugin
  • Utveckling
  • Blogg
  • Boka support
    • Kontakta WP-akuten/KoBoToLo
    • Pro bono
    • Integritestpolicy

Styla dina wordpress block

WP Akuten > Utveckling WordPress > Gutenberg > Styla dina wordpress block

skrivet den 20 juli, 2020, uppdaterat den 20 maj, 2021 av Karin H Olsson

Ibland så kan det behövas att man skapar en extra stil (style) på ett block i Gutenberg. Det underlättar om man som här vill ha extra stil på en knapp.

Jag kallar här stilen för fyll-ut

Och då läggs följande css till:

  • Full bredd (100%)
  • Botten marginal
  • Blå bakrund
add_action( 'after_setup_theme', 'kobotolo_gutenberg_css' );

function kobotolo_gutenberg_css () {
  register_block_style(
    'core/button',
    array(
       'name'  => 'fyll-ut',
       'label' => __( 'Fyll ut', 'text-domain' ),

     'inline_style' =>
     '.wp-block-button.is-style-fyll-ut { 
         width:100%;
         margin-bottom:1rem; 
         background:blue;}',
      )
  );
}

Det här underlättar om du ofta har inställningar som du vill återanvända.

För mina kunder underlättar det genom att de bara behöver klicka på en stil och inte behöver lägga till en css-klass.

Så här ser det ut vid redigering:

Karin H Olsson

Jag arbetar med teknisk utveckling i WordPress – framförallt när standardlösningar inte räcker.

Jag har en bakgrund som konstruktör inom realtidssystem (de system som finns i bilar, flygplan m.m.) och har följt utvecklingen hela vägen till dagens moderna webb.

Med utbildning inom både systemvetenskap och psykologi arbetar jag i gränslandet mellan teknik och användning – där systemen inte bara ska fungera, utan också fungera för människor.

→ Läs mer KoBoToLo – Om KoBoToLo en webbyrå i Karlskoga

FöregåendeRegistrera temafärger i Gutenberg
NästaSkapa block mönster i GutenbergDags att uppdatera
Kategori: Gutenberg

Läsarkommentarer

Lämna ett svar Avbryt svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Sidebar

Att välja webbhotell

Vi använder Oderland som webbhotell

Läs mer om att välja webbhotell

 

Du hittar mig i Värmland bland skogar, vargar och sjöar


Mail: info@kobotolo.se

Vill du istället att vi kontaktar dig så skicka ett mail så ringer vi upp. Du kan också fylla i vårt kontaktformulär:


Be mig kontakta dig


Maila mig



Tel: 070 – 49 34 191

Onsdagar 9.00 till 10.00 är vår stående hjälptimme. Då ger vi tips och råd per telefon till kunder och icke-kunder. Ingen fråga är fel!

Övrig tid kan vi tyvärr inte ge support per telefon!

Copyright © 2026 · WordPress Akuten · All Rights Reserved

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in .

  • Svenska
Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

Analytics

This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.

Cookie Policy

More information about our Cookie Policy