CSS, text align and padding right

I have a

that I want to text-align right but with padding-right of 5-10px. Can’t figure out the solution. Any help from the CSS gurus would be much appreciated …

the css snippet:


.screen {
  height: 70px; 
  width: 96%; 
  color: #F0F0F0;
  font-size: 50px; 
  line-height: 70px; 
  text-align: right;
  margin-right: 5px;
  border: 1px solid #b4b39d;
  border-radius: 10px;
  overflow: hidden;
  padding: 10px;
  box-shadow: 
    7px 10px 34px 1px 
    rgba(0, 0, 0, 0.68), 
    inset -1px -6px 12px 0.1px 
    #89847e;
}

and my html snippet:

<div class="screen">0</div>

If you are using bootstrap, you can use <div class ="screen text-right>0</div> and you should be able to add padding to that selection with the your settings in css. I hope that helps.

1 Like

Sorry if I don’t understand correctly but don’t you already have padding ?

I’m not using bootstrap :frowning:

the padding doesn’t work … hence my question …

Do you have a codepen.io link?

I’m sorry the Codepen just gave me context, never-mind me.

1 Like

Ok so just plane padding takes four inputs for all directions and you are only padding the top. If you only need to pad right use padding-right.

padding-right moves the whole <div> container, I need to pad the text within, kinda like text-align but with fine-tune(able) like top, right, bottom, left does in everything else

I was able to get your desired result from changing the width to 270 and the padding right to 20 but idk where the other 10px is going towards your width since only 290 of it is “onscreen”.

1 Like

yeah, I’m stuck now … the 270 width change smashes it up too much …

If by “mash” you mean you need more space, you could always add to the padding and lessen the width by even amounts

width: 270
padding: 20

to

width 260
padding 30

I’m sorry that’s all I got for now :confused:

1 Like

all is well boss, it’ll work itself out or it won’t … time to go sit by the fire

1 Like

fixed by adding Bootstrap CSS … didn’t want too, since it is being dropped out of fashion, but it did resolve the alignment issue … thanks to @sebalex11 and @trvon :thumbsup:

1 Like

the “mostly” completed calculator -