Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Jonathan Whalen
Jonathan Whalen
7,201 Points

CSS Foundations Margins, Aligning, and Centering, Barista Tool Practice

Hey! I am working my way through the foundations of CSS and developing a simple Barista tool for practice. If I want to center my .block div within the page, and the table within the div containing the Brew Method and Notes section, what should I do differently? Right now when I fullscreen in chrome my table is slightly to the left of center... Thanks! Jon

<div class="block">
      <form>
             <table class="table">
               <thead>
                 <tr>
                  <th>Brew Method</th>
                  <th>Notes</th>
                 </tr>
            </thead>
            <tbody>
            <tr>
            <td>
                <input name="radio" type="radio" id="radio1"><label for="radio1">Espresso</label><br>
                <input name="radio" type="radio" id="radio2"><label for="radio2">Full Immersion</label><br>
                <input name="radio" type="radio" id="radio3"><label for="radio3">Pour Over</label><br>
                <input name="radio" type="radio" id="radio4"><label for="radio4">Commercial</label><br>
                <input name="radio" type="radio" id="radio5"><label for="radio5">Other</label><br>
                </td>
                  <td>
                    <input type="text" id="notes">
                  </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
.bg {
  background: black;
}

.box {
  background: white;
  margin: auto;
  border-radius: 10%;
  padding: 20px;
}

.block {
  width: 50%;
  margin: auto;
}
Jonathan Whalen
Jonathan Whalen
7,201 Points

how do I make the code visable in my post? Im giving it three backticks but it still translates the html... help please?

Edited your post to add MarkDown for embedding code. If you now click edit you can see the backticks required and optional language name :)

Jonathan Whalen
Jonathan Whalen
7,201 Points

i figured it out, and was probably just tired last night dancing around the answer, or not saving properly... all i did was add a specific class to the table within the div with a margin: auto; and it centered evenly, not sure what i was botching yesterday

Blame it on tired eyes :)

1 Answer

Jonathan Whalen
Jonathan Whalen
7,201 Points

Thanks Adam! This will be very helpful for future posts