i noticed that u cant style specifically change the color of an svg file when its placed inside an image tag, any recommendations on how i can style svg images and what tags i should use instead.
Latest comments
- @Temiboss1Submitted 12 days agoWhat specific areas of your project would you like help with?@adonmez04Posted 11 days ago
Hi Temiboss1. It is a good question.
- SVG is the part of XML, not HTML. That means it has some unique features than HTML. There are some SVG attributes. You can check them here: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute.
- You can use the
fill
attribute to change the color of SVG elements like<rect fill="red">
. It works likebackground-color
. You can also use it as a property in your CSS file, likerect { fill: red }
. The background-color property doesn’t work for SVG elements. - If you use an SVG element as a basic image, you can use
img
tag. If you want to change something on it, like size or color, you can usesvg
tag to have full control over it. - Unfortunately, we don't have enough resources to understand how SVG works. I recommend this book to deeply understand some features in CSS and SVG: https://www.manning.com/books/tiny-css-projects
Marked as helpful2 - P@jellmooSubmitted 13 days agoWhat are you most proud of, and what would you do differently next time?
Proud of my use of Flexbox as I've been learning it recently and have been wanting to implement it more correctly in my code.
What specific areas of your project would you like help with?Please give feedback on my css flexbox and just my css in general! I'm trying to work on making sure my code will look good on all screens
@adonmez04Posted 12 days agoHi Moe. Everything looks good. Here are some tips:
- You don't need
display: flex
for youra
elements. You havetext-align: center
for thebtn-list
class and it will center any text within it. - You also don't need
display: flex
for yourprofile-pic
class. Give yourimg
elementmargin-inline: auto
and it will be centered within of the containing block. - Feel free to use
min-inline-size
for the containing block. It avoids some broken UI elements. You can give your article elementmin-inline-size: 150px
.
Actually, you don't need to use
display: flex
for this challenge. Everything is in the normal document flow that is from top to bottom. Try to code this challenge without using flex or grid and see when you should use flex or grid.Marked as helpful0 - You don't need
- @brweinsteinSubmitted 13 days agoWhat are you most proud of, and what would you do differently next time?
Learning the basics of HTML and CSS. This acts as my first project.
What challenges did you encounter, and how did you overcome them?I had trouble with centering the content on the page and learned that I could use flex display.
What specific areas of your project would you like help with?Is there a different way to center the contents of the page without a flex display? What are some other general ways to optimize the code?
@adonmez04Posted 12 days agoHi Ben Weinstein.
Centering an element is a little tricky. You can use
margin-inline: auto
to center it horizontally. However, you should explicitly declare a width value for the element itself. If the width value isauto
(it is the initial value),margin-inline: auto
will render 0. So it will not work... Also, giving an explicit width value will break the browser's responsive behavior. This is why we should usemax-inline-size
(or max-width) instead of width. You can try yourdiv
element withmargin-inline: auto
and it will be centered horizontally...For vertical centering, the containing block should have some extra space to distribute it. For your solution, this is the body element. Remove
display: flex
and give it toplace-content: center
and keep theheight: 100vh
.place-content: center
will center its direct child element vertically without usingdisplay: flex or grid
. This is a brand new feature, and the containing block should have some extra space.Marked as helpful1 - P@DeKapitoSubmitted 13 days agoWhat are you most proud of, and what would you do differently next time?
I'm proud that I was capable to finish this project :D
What challenges did you encounter, and how did you overcome them?It was difficult to make layout change when window is resized
What specific areas of your project would you like help with?I need to learn more about flexbox and grid
@adonmez04Posted 12 days agoHi DeKapito. There are some resources for understanding flexbox and grid in depth. Good luck to you :)
- https://courses.kevinpowell.co/conquering-responsive-layouts
- https://web.dev/learn/css/flexbox
- https://web.dev/learn/css/grid
And make some challenges again and again for the better version of it...
0 - P@L4r4TWSubmitted 13 days agoWhat are you most proud of, and what would you do differently next time?
I'm most proud of the almost perfect looking design, and good responsivity. Next time maybe I should use more responsive properties instead of px, but using px makes it easier to create really similar design like in the figma file.
What challenges did you encounter, and how did you overcome them?Making the elements fit perfectly into phone screen was hard, but with chatGPT and StackOverflow, I figured out a pretty good solution.
What specific areas of your project would you like help with?- Should I make my project pixel perfectly look like the figma desig? The size of elements and spaces are given in px in figma. Shlould I use this px parameters, or use more responsive ones, like em, rem, % etc.
@adonmez04Posted 13 days agoHi, Bruno. That is a good question. You can use;
- the
rem
unit for thefont-size
. - the
em
unit for thepadding
. - the
px
unit for themargin
,border
,radius
etc.
The point of using relative or absolute length units is that we want to know which element can or can't change its size. If we want users to be able to change the size of fonts, we can use the rem unit... On the other hand, if we don't want to change the size of the margin or the border radius, we can use the pixel unit. The em unit refers to the current element's font size, and most of the time it is very useful to use em for padding, but as a beginner you can use rem instead.
Marked as helpful1 - @John-Davidson-8Submitted 7 months agoWhat are you most proud of, and what would you do differently next time?
- I am pleased with this project because I learnt the basics of CSS Grid and in particular Grid with media queries to create the collage for desktop.
- Also, in the CSS I attempted to group classes and elements together in an attempt to write less code. I have a bad habit of repeating code in the CSS file unnecessarily. Not having I don't think any redundant code. Although, I may be wrong, when someone looks at it! lol.
- What would I do differently? Maybe not use section element for each testimonial card.
- CSS Grid takes time to get my head around. I think this is the third or fourth project in which I have attempted to use it. It does take time, but I think I am slowly getting to grips with it.
- Organising HTML has always been a problem for me. I tend to overdo it with the divs and containers, however in this project I have calmed down a bit!!
- Organising my HTML and when to use semantic elements and which semantic element to use and when to use divs for styling purposes.
- Naming classes appropriately is another issue I could do with help on. I attempt to make the class names as descriptive as possible.
@adonmez04Posted 7 months agoThis challenge is really hard... Make sure you solve it over and over again when play with some grid features. It'll be a milestone in your coding journey... Just a few quick tips:
- You can use
align-items: start;
for yourflex-avatar
class to avoid stretching images. And you can set amin-height
to keep your images viewable likeimg { min-height: 2rem }
etc. - Have fun...
- My comment here is done...
- But you didn't give anything for the Grid features...
- Flies away :)
Marked as helpful0