I want to know more about the best practice for DOM manipulation, more specifically, the appending of HTML elements created using JS. I am used to create an element with javascript and change the innerHTML of that element. After that, I append it to the body or other element within the body. Howevet, I directly changed the innerHTML of the element DIreclty in this small project because it is on a small scale.
Muhammad Adam
@Muhammad-adam778All comments
- @ahmedd-osamaSubmitted almost 2 years ago@Muhammad-adam778Posted almost 2 years ago
- عاش يا بطل .احنا عرب اه لكن هستأذنك أتكلم انجليزي عشان الكلام بيدخل في بعضه هنا ومش هتفهم مني حاجه
- There is some tips to improve design & solve accessibility problems:
- First About Accessibility : In Html file delete role attribute from
<main>
and<footer>
elements, you don't need it. - Second About Design:
- You need to hide the scrollbar & center the footer horizontally, to do that check this steps:
- To hide scrollbar :
- Set the margin of
<body>
tozero
- Set the position property of
<footer>
toabsolute
and the bottom property tozero
.
- To center the footer horizontally, check code below:
footer { left: 50%; transform: translateX(-50%); }
-
For mobile : Add
text-align: center
to the<footer>
-
I hope you find that helpful.
Marked as helpful1 - @ProcodxSubmitted almost 2 years ago
very quick project....i felt like i was doing a baby work 😂😂
@Muhammad-adam778Posted almost 2 years agoGood job my friend.
- There is a little tips to improve the accessibility :
- Any section element should contain a heading but in this challenge there is no heading so you need to delete
<section>
element like code below: - Heading should increase one by one from
<h1>
to<h6>
, in your code you jumped from<h1>
to<h4>
, try to replace<h4>
by<h2>
and if you need to descrease the font-size you can do that by css, please check code below.
<main> <img src="images/illustration-hero.svg" alt="hero dancing"> <article> <div class="text"> <h1>Order Summary</h1> <p>You can now listen to millions of songs, audiobooks, and podcasts on any device anywhere you like!</p> </div> <div class="plans"> <div class="img-plan"> <img src="images/icon-music.svg" alt=""> <div class="price"> <h2>Annual plan</h2> <p>$59.99/year</p> </div> </div> <a href="#">Change</a> </div> <button>Proceed to Payment</button> <a href="#" class="order"> Cancel Order </a> </article> </main>
- I hope you find this helpful.
0 - @Agil-SaputraSubmitted almost 2 years ago
Which should I add to make this component better? Should I use framework to make this or just plain html/css?
@Muhammad-adam778Posted almost 2 years ago- "Which should I add to make this component better? Should I use framework to make this or just plain html/css?".
- You don't need to use any framework, this project is very simple, pure css and html will do the required.
- But there is some points you need to fix to solve the accessibilty problems:
- You don't need all of these divs.
- You need to use semantic html elements like
<main>
,<article>
if you want to know how, please check this code below :
<body> <main> <article class="container"> <img src="images/image-qr-code.png" alt=""></div> <h1>Improve your front-end skills by buillding Projects</h1> <p>Scan the QR code to Visit Frontend mentor and take your Coding to The next level</p> </article> </main> </body>
- If you want to know about semantic elements check this article Semantic HTML Elements.
- I hope you find this helpful.
0 - @NA1DES17Submitted almost 2 years ago
I started the project in a very easy way and once the version for mobile devices was finished I had some problems to make the desktop site. Once the problems were solved, for some reason I destroyed the mobile version. But everything was solved and the project was finished.
@Muhammad-adam778Posted almost 2 years agoGood job, Nicolas it almost match the design
- About accessibility:
- In the first and third warning: Semantic HTML Elements would solve the problem, you need to use elements like
<main>
,article
,figure
, andbutton
. - If you want to know about Semantic Elements check this link Semantic HTML Elements.
- In the second one : You need to add
<h1>
Element to your page. - I hope you find this helpful.
Marked as helpful0 - @eduardozamitSubmitted almost 2 years ago
I'm not really sure about my container centering method and I intend to implement this code in the future to make it better.
if you have any tips for me i would be grateful!
@Muhammad-adam778Posted almost 2 years agoGood job it almost match the design.
- There is many ways for centering, one of them is to use
position
css property withtransform
property. check this code to know how.
/* For vertical centering*/ position: absolute; top: 50%; transform: translateY(-50%); /* For horizontal centering*/ position: absolute; left: 50%; transform: translateX(-50%); /* For both*/ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
-
But first you need to reset margin of
<div class="container">
to zero. -
About accessibility:
-
Try to replace
<div class="attribution">
element by<footer>
element. -
I hope this help you.
Marked as helpful0 - There is many ways for centering, one of them is to use
- @joshuaadrianSubmitted almost 2 years ago
Does anyone have good reasoning for when to use flex or grid?
@Muhammad-adam778Posted almost 2 years ago- Grid is good for full page layout
- Flex is useful for organizing each section of a page, not the whole page Check this image to know what i mean Flex vs Grid.
- About accessibility:
<img src="images/icon-cart.svg" alt="Add to Cart">
try to use dash between words in alt attribute like this Add-to-Cart.- You nead to use semantic elements like <main>, <article> and <footer> If you want to know about Semantic Elements check this article HTML Semantic Elements.
- I hope this help you.
0 - @eligijuslinkeviciusSubmitted almost 2 years ago@Muhammad-adam778Posted almost 2 years ago
Good job Eligijus, it almost match the design
- About accessibility report:
try to replace the
<div class="container">
element by the<article>
element and the<div class="attribution">
by<footer>
element, and put all of that in<main>
element like this
<main> <article> <img src="./images/image-qr-code.png" alt="QR Image"> <h1>Improve your front-end skills by building projects</h1> <p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p> </article> <footer> Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. Coded by <a href="www.github.com/eligijuslinkevicius">Eligijus Linkevicius</a>. </footer> </main>
These elements above is called semantic elements.
- You can read about semantic Elements in this article HTML Semantic Elements
I hope this helps you
Marked as helpful0 - About accessibility report:
try to replace the
- @Tumelo4Submitted about 2 years ago
How can i change image without using javascript when it comes to responsive design? I tried to use background-image and it wan't giving me desired result.
@Muhammad-adam778Posted about 2 years agoTry to add the two images to the page at the same time, but one of them should be
display: none;
(to be hidden) and the other should bedisplay: inline
(to be visible), if you are in desktop the desktop image isdisplay: inline;
and if you in mobile the mobile image should bedisplay: inline
. to make that check this css code below:/*Small screens*/ @media (max-width: 767px) { .mobile-img { display: inline; } .desktop-img { display: none; } } /*Large screens*/ @media (min-width: 768px) { .mobile-img { display: none; } .desktop-img { display: inline; } }
0