What if my code doesn't match the solution code?

You'll see on this journey that many times with code there can be multiple ways of solving the problem. There isn't always black and white, right or wrong ways. Sometimes it is a matter of option or company style; some techniques  may be too new to be supported on all browsers, so we have to find workarounds; etc.

Ultimately, you want to ensure your code is clean and readable, that it works well on as many browsers and screen sizes as possible (we talk about that with responsive development), and that you can make adjustments writing (ideally) as little code as possible.

Time is money. So if you can accomplish something with four lines of code rather than sixteen: Boom! More time on your hands so more $ in your pocket and making changes later will also be faster!

This may mean you add structural elements like a container div, so you can set the width of multiple sections at once. You may look to see which elements will be styled the same and assign them all the same class. You may group elements in your stylesheet that all have the same styles and separate the selectors with commas, so you are only writing the properties once:

	.thing-one, .thing-two, .thing-three {
		font-family: Arial, sans-serif;
		font-size: 16px;
		color: black;
	}

And don't forget that as you learn more, you may learn new and simpler techniques to accomplish the same look! Enjoy the journey.

Still need help? Contact Us Contact Us