2

Dammit! CSS is such a huge pain in the ass. I just want to use a <style> tag inline with a class to control margin positioning of one friggin’ image. (Yes, I know it’s better in a CSS file but this is a temp fix that will be reverted soon.)

<style>
.30-day-seal {
margin-top: -27.5em;
margin-left: 39.5625em;
}
</style>
<img class=“30-day-seal” src=/path/to/img.png”/>

Nothing happens. Only if I use a style=“” attribute directly in the img tag.

I’ve even tried:

<style>
img.30-day-seal {
margin-top: -27.5em;
margin-left: 39.5625em;
}
</style>

And

<style>
.30-day-seal img {
margin-top: -27.5em;
margin-left: 39.5625em;
}
</style>

And even

<style>
img .30-day-seal {
margin-top: -27.5em;
margin-left: 39.5625em;
}
</style>

Why do I suck so bad at this?! Still!?

Comments
  • 7
    Dont start you classname with a number... Just like anything in the development world...
  • 1
    Wow. I can’t believe I made such a rookie mistake. Classes can’t begin with numbers. *sears it into failing memory*

    Thanks.
  • 0
    Also try not to use float numbers as height or weight or even font
    Use vw and vh

    10, 15, 20, 25 and so on
    Idk , the OCD inside me doesn't like 27.39px or 29.28238em ><
  • 1
    @Clear0Ff That’s another thing that pisses me off about CSS. There are like 10 different units of measurement “depending” on about 100 different uses of CSS. And you can read about 1,000 different opinions on why one unit is better than another. OMG, whyyyy are we doing this to ourselves? In 2018! When we’re this close to living on Mars and the Moon and having flying cars!
  • 0
    @stackodev just stick with a few that make you feel comfortable with, idk if we can do anything else
  • 0
    @stackodev because for some things we want a fixed size (px), for other things a size relative to the parent (%) and other times we need a unit scaling to the fontsize (em/rem)and the new one used for css Grid is also needed (forgot the name since I havent done ant frontend in a year)

    To make something accessible for everyone on each device you need all of these units. The problem is that most frontend people I know dont know what to use when, and from reading your comment you are such a person.
Add Comment