What is the correct way to create this margin?, Help with margins best practice |
What is the correct way to create this margin?, Help with margins best practice |
JUI43555 |
Apr 14 2023, 07:12 AM
Post
#1
|
Member Group: Members Posts: 44 Joined: 6-March 23 From: Perth Member No.: 28,833 |
Hi,
In the screenshot below there is a 165px margin between the main heading and the left hand side (same on the right hand side) What is the best way to write that into my CSS? Is it with the use of margins? Padding for each individual element? Don't want to add something in the wrong place this early in the build. Cheers. CODE <section class="hero"> <div class="hero__content-intro"> <h1 class="hero__content-intro--heading">Typemaster keyboard</h1> <p class="hero__content--p">Improve your productivity and gaming without breaking the bank. Upgrade to a high quality mechanical typing experience.</p> <div class="hero__button"> <a role="button" href="#">Pre-order now</a> <span>Release on 5/27</span> </div> </div> <div class="hero__image"> <img src="images/desktop/image-keyboard.jpg" alt="Typemaster Keyboard - Midnight Grey" /> </div> </section> |
Christian J |
Apr 14 2023, 10:02 AM
Post
#2
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
To me it looks like padding on div.hero__content-intro would be the simplest, that way you don't need to add left-margins to all its child elements. Other than that I don't think there is a right or wrong way.
|
JUI43555 |
Apr 14 2023, 09:50 PM
Post
#3
|
Member Group: Members Posts: 44 Joined: 6-March 23 From: Perth Member No.: 28,833 |
|
Lo-Fi Version | Time is now: 27th April 2024 - 08:57 AM |