Design comparison
Solution retrospective
This is my second attempt at this project. After some suggestions from the community, I decided to take the advice I got and start over. (Thank you, @tl-lucasestevam and @grmajik!)
I learned so much on my second attempt! The first time, I was trying to apply the purple over the image as a separate div, stacked on top. It was a mess. I had no idea I could just set the image as a background and put a transparent gradient over it. I will be getting a lot of use out of that in the future!
I also learned about using semantic tags like h1, span, etc. and styling them how I like instead of using lots of divs and giving them class names. It looks much cleaner this way.
Anyway, I am still very open to suggestions. I could use some help with the responsive image's div. How can I keep the proportions the same instead of cutting off parts of the image as the screen resolution gets smaller? Thanks for taking a look!
Community feedback
- @tl-lucasestevamPosted over 3 years ago
First congratulations! Your code is much cleaner now.
But there are still some caveats, when starting a tag like h2 you cannot put a div inside it to make some of the text highlighted use the strong tag for example inside h2 instead of the div.
<h2> Get <strong id="insights">insights</strong> that help your business grow. </h2>
And also in the stats part you put a span wrapped around a div, this is not allowed in the HTML, do it that way:
<div> <span class="number">10k+</span> <span class="word">companies</span> </div>
So that you can better understand the concepts of div and span I got the definitions from w3schools.
DIV:
The <div> tag defines a division or a section in an HTML document. Note: By default, browsers always place a line break before and after the <div> element.
SPAN:
The <span> tag is an inline container used to mark up a **part of a text, or a part of a document**. The <span> tag is much like the <div> element, but <div> is a block-level element and <span> is an inline element.
In other words, a div is used to represent a block of other HTML elements, whereas a span is used to mark part of the text/document. The other difference also the div is a block-level element that way it occupies all the space it can take up on the screen, this can be seen in dev tools when inspecting a div since the span is an inline element, it only takes up space the element within it needs.
Link to a post that better explains this concept
About the image to keep the same height without it being cut to the same proportion I don't know anyway. But you can put the media query to put the image on top when it starts to get too cropped by 900px / 800px.
Whenever you send a project here to the mentor frontend it goes through an analysis to check for some errors, you can see this report by clicking on the "view report" button in the blue field below your project preview.
Congratulations again! keep studying and practicing!
Marked as helpful2
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord