Skip to main content

2 posts tagged with "css"

View All Tags

Quick CSS Tips - part 1

· One min read
Anand Raja
Senior Software Engineer

Changing the color of checkbox if checked

<label for="checkbox1" class="checkbox">
<input id="checkbox1" type="checkbox" role="checkbox" />
<span class="custom"> Checkbox </span>
</label>

Centering a Text Inside a Button

· One min read
Anand Raja
Software Developer
Anand Techie
Software Developer, JS Specialist

Instead of centering headings and paragraphs, let’s center text inside another element (<button> </button>). Aligning the button, and the text inside the button, would differ slightly from the examples.

That’s because the text-align property only works on the content inside block-level elements, such as headings and paragraphs, and not inline elements, such as buttons.

So here's what we'll do instead:

  • Wrap the button in a div
  • Then, add an inline style declaration to the div, i.e. <div style="text-align:center">.