Latest solutions
Responsive Article Preview Component using Tailwind and JavaScript
#accessibility#tailwind-cssSubmitted over 1 year agoResponsive Base Apparel Coming Soon Page using Tailwindcss
#accessibility#tailwind-cssSubmitted over 1 year agoNFT Preview Card Component solution using Tailwindcss
#accessibility#tailwind-cssSubmitted over 1 year agoResponsive Single Price Grid Component using Tailwindcss
#accessibility#tailwind-cssSubmitted over 1 year agoResponsive Single Price Grid Component using Tailwindcss
#accessibility#tailwind-cssSubmitted over 1 year agoResponsive Four Card Feature Section using Tailwindcss
#accessibility#tailwind-css#styled-componentsSubmitted over 1 year ago
Latest comments
- @d-donneSubmitted over 1 year ago@d-donnePosted over 1 year ago
I notice my design is smaller, I now realize the design images are not to scale 😔. I will change my dimensions on it.
0 - @xmavvSubmitted over 1 year ago@d-donnePosted over 1 year ago
Hi @xmavv. Great job on this project.
Concerning your question on max-width
Block level elements like div, section, main, footer, etc already take the full width of their parent element, so in most cases, it's not necessary to set width: 100%.
The max-width property tells the browser the maximum horizontal space the element can cover. As such you may not see it's effect if the element itself is not big enough to cover that space. It is however useful if the element, say an image has a width that can grow to be greater than that of the parent element. This will make it able to shrink, but not grow past its parent.
concerning background image
If the image's primary role is to serve as a background, then you should use the CSS
background-image
property. If it's an image that adds meaning to the page, then use HTML<img src="" alt="">
tag - and always remember to add alternative text for semantic reasons. That being said, it is sometimes difficult to manipulate certain images when used as background-image, hence the img tag is used in these situations and manipulated in the CSS.I hope this helps.
Marked as helpful0 - @shimaaosamaSubmitted over 1 year ago@d-donnePosted over 1 year ago
Hi there, Shimaa, good job so far. I've looked at your code, and I have some notes that could be of help to you. These are more of opininons based on what I know so far that I think will help.
NOTES
I've noticed you've used a lot of divs in your HTML. Since the div element has no semantic value, there's no need to use it unless you need to group certain elements together to help in styling or any other purpose.
img - you have specified the dimensions of your image a bit too big looking at the design.
HTML
<main class="container"> <div class="container-image"> <img src="image-qr-code.png"> </div> <div class="container-body"> <h1>Improve your front-end skills by building projects</h1> <p> Scan the QR code to vist Frontend Mentor and take your coding sills to the next level </p> </div> </main>
For accessibility reasons, you could change your container div to main.
The container then can have two divs nested in it, one with a class of container-image for QR code image, and the other with class of container-body for the heading and text. This will help if you want to you use flexbox or grid, and the naming will also help easily identify them.
After setting the width of the container, you don't necessary need to give the image a seperate width. and the texts will also follow to suite the width. You can then add some padding for the internal spacing. I usually like to do `box-sizing: border-box', so my padding and margin don't increase the containers size. like so before any other styling:
CSS
* { box-sizing: border-box; body { width: 100vw; height: 100vh; /* center the container */ display: flex; align-items: center; justify-content: center; } .container { display: flex; width: 50vw; /* edit to suit design */ padding: 15px; /* edit to suit design */ h1 { font-weight: 700; }
To make it easier to follow, your CSS selects should be in the order they appear in the HTML or page, and grouped according to sections in the CSS file.
Also, the font-weight CSS proper does not take any units.
I hope this helps, @shimaaosama. Please ask more questions, if needed.
You can look at my solution here
0 - @Lina-HamoSubmitted over 1 year ago@d-donnePosted over 1 year ago
Hi @Lina-Hamo, to answer your question
you could give your profile div a margin-top of negative values. Say
.profile { margin-top: -2rem; }
this will move it up
1 - @MarutovskySubmitted over 1 year ago@d-donnePosted over 1 year ago
To answer your question on using elements (Tag names) as CSS selectors, there's actually nothing wrong with it if you want elements of that type to have a general styling.
Class Names Have Higher Specificity Than Tag Names.
When you give that element a class name, the CSS styling using the class name will override the Tag name's styling affected by that CSS property.
For instance:
HTML
<p class="text-red" id="text-green">
CSS
p { background-color: black; color: white; } .text-red { background-color: yellow; color: red; } #text-green { color: green; }
If this paragraph is styled using the CSS, it'll actually show a green text with a yellow background, because IDs are more specific than class names, and class names than Tag names.
Here is an article I found: Importance of CSS Specificity
Marked as helpful0 - @UriasKermue18Submitted over 1 year ago@d-donnePosted over 1 year ago
Hi. Good job so far. You could use border-radius on your container to make the edges rounder.
Font
The link to the font used in the design is in the style-guide file. Better still, just add this to the the top of your css:
@import url("https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400;700&display=swap";
and then set the font-family as
body { font-family: "Public Sans", sans-serif; }
This should bring the design closer. Also ask questions if you need more clarification.
0