This is an old crappy headboard my wife and I built 13-ish years ago. It was a lot better than the headboard we didn't have at the time. But there were issues with it. It wobbled when you leaned against it. It was kept upright by being bolted directly to the bed frame, but not a very solid feeling headboard. The other problem was we only have 2 pillows, and to lean against it to read or watch TV in comfort, one person would need both pillows. We wanted a sloped and padded headboard, but never could find just what we wanted at any furniture store.
I had some 2 X 6s on hand, so I figured I'd turn those into braces or brackets, but I didn't know what dimensions would be needed, so I just used some blue tape on the floor and just messed around with it until I got what I felt was the right size.
At the end of the 2 X 6s, I measured out 2.5". Then I measured 17" down and made another mark. Drew a line between those marks and made my cut. The overall length wasn't all that important, just as long as it was long enough for the mattress to butt up against the 2 X 6s a few inches below 17" mark. This was done so that when the headboard is installed, it overlaps a little bit on the matress so there is no gap for the pillows to drop into.
With the old headboard, there was a 2 or 3 inch gap and my pillow would always work its way into that gap, thus my pillow would get smaller and smaller during the night. So no gaps this time!
Purchased a cheap sheet of 4 X 8 ply, had them (Lowes) rip it into two 24" wide strips. Ignore the 3rd piece of smaller piece.