June 24, 2024, 7:18 a.m. | qui

DEV Community dev.to

Hello! I love Markdown code blocks but in default, we don't have Markdown code blocks in HTML. We'll do it with CSS.





1. Adding CSS





1.1. Using Another file for CSS



  • Add this to your CSS: <link rel="stylesheet" href="style.css">

  • And put this code in style.css:



.code {
width: auto;
max-width: 80%;
background-color: #2d2d2d;
color: #ffffff;
border: 1px solid #444;
border-radius: 8px;
padding: 20px;
margin: 0 auto;
font-family: 'Courier New', Courier, monospace;
font-size: 14px;
line-height: 1.5;
overflow-x: auto;
white-space: pre-wrap;
word-wrap: …

auto code color css file hello html love markdown max style webdev

AI Focused Biochemistry Postdoctoral Fellow

@ Lawrence Berkeley National Lab | Berkeley, CA

Senior Data Engineer

@ Displate | Warsaw

Senior Backend Eng for the Cloud Team - Yehud or Haifa

@ Vayyar | Yehud, Center District, Israel

Business Applications Administrator (Google Workspace)

@ Allegro | Poznań, Poland

Backend Development Technical Lead (Demand Solutions) (f/m/d)

@ adjoe | Hamburg, Germany

Front-end Engineer

@ Cognite | Bengaluru