One snippet does not work but others do

I am a new user of obsidian (sort of, i’ve been 6+ months at it but am only going into customizing things now.)

What is my issue?
I have a small css snippet that, for some reason it does not work:

.full-reading {
body {
  --file-line-width:1000px !important;
}
}

I utilize the properties of the notes to assign tags with the corresponding css classes, I picked up some from the internet, for example, these work:

.zoom-image {
img {
  max-width:100%;
  cursor:zoom-in;}

img:active {
  cursor:zoom-out;
}
.markdown-preview-view img[referrerpolicy='no-referrer']:active,
.image-embed:active {
  background:var(--background-primary);
  cursor:zoom-out;
  display:block;
  z-index:200;
  position:fixed;
  max-height:100%;
  max-width:100%;
  height:100%;
  width:100%;
  object-fit:contain;
  margin:0 auto;
  text-align:center;
  padding:0;
  left:0;
  right:0;
  bottom:0;
}
.image-embed:active img {
  top:50%;
  transform:translateY(-50%);
  padding:0;
  margin:0 auto;
  width:100%;
  max-height:100vh;
  object-fit:contain;
  left:0;
  right:0;
  bottom:0;
  position:absolute;
  opacity:1;
}
}

.h1-text-align-center .HyperMD-header.HyperMD-header-1 {
    text-align: center;
}

/* PREVIEW MODE */

.h1-text-align-center .markdown-preview-view h1 {
    text-align: center;
}


Inserting “zoom-image” and “h1-align-text-center” inside the “cssclasses” properties work. But “full-reading” does not work.
image

I am using the latest version of obsidian (1.6.7) and have the following plugins enabled:

It should be written as:

.full-reading {
   --file-line-width: 1000px;
}

Tested and working using the default theme. Minimal would require something slightly different, but has its own wide and max helper classes ready to go out of the box.

1 Like

Thank you!

I’m not really versed in css stuff, so I was going off multiple forums I read online (I didn’t understand them very much.)

body comes before any custom classes in the order of things, so this works as well, although not necessary in this case.

body .full-reading {
   --file-line-width: 1000px;
}

If you are interested in jumping in more, here are some handy links from Carl (the Discord bot):

You can change Obsidian’s color scheme, use a custom theme created by our community, or customize further by using CSS snippets. Some community resources:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.