Unable to style a box created by a custom template

I’ve created a twentyfourteen child theme by using the One-click Child Theme plugin. Then I created a custom template called “custom-table” by copying page.php in the parent theme directory to custom-table.php, also in the parent theme directory.

Next I changed the header in the new Custom Table template to

Read More
<?php
/**
 * Template Name: Custom Table

so it shows up in the Template dropdown under Page Attributes for a new page.

Next I created a new page, “Table1,” and selected Custom Table from the Template dropdown.

Next I modified the custom-table.php template to create a simple box:

<div id="box123"></div>

I can see this box ok in the source for the Table1 page, but I’m unable to style the box. I’ve put:

div#box123 {
       width: 200px;
       height: 150px;
       background-color: red;
}

in the child style.css but that doesn’t work. And I’ve put the above style block in the parent style.css. That doesn’t work either.

So where should I put the styling for this box?

Thanks for your help.

Related posts

1 comment

  1. Your css should go in the child theme style.css.

    However, inspecting the page there is no css file loaded at all. I suspect your problem is you’re not using the get_header() function in your template file. You’ll need this for WordPress to create the <head> tags and everything that goes inside it including the main style file.

    In the 2014 theme at line 14 is where you’ll find get_header(). Make sure it’s in your page template file too.

Comments are closed.