Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialIvan Tomicic
3,873 PointsCan't align SVG
Hello guys...
I have problem with aligning SVG images, if I try this with divs and not with SVG images everything works, I even tried putting images inside of DIVS but still same result...
This is what I'm getting in chrome:
And this is how it looks like in mozilla and how it SHOULD look like:
Here is my code as well:
<div class="blogimg">
<div class="veralign blogimgwrap">
<img src="images/blog_text.svg" class="imgtext">
<img src="images/blog_avatar.svg" class="imgavatar">
</div>
</div>
.blogimg {
width:100%;
height:calc(100% - 200px);
}
.blogimgwrap {
width: 100%;
height: 100%;
margin: 0 auto;
position: relative;
overflow: hidden;
}
.imgtext {
max-height: 100%;
}
.imgavatar {
position: absolute;
right: -40px;
bottom: 0px;
max-height: 90%;
}
7 Answers
Graham Davidson
Courses Plus Student 14,966 PointsHi Ivan - do you have this on a link somewhere so I can have a nose at the developer tools
Graham Davidson
Courses Plus Student 14,966 PointsThe actual SVG is 2400 px wide (ish) its positioning correctly but there in which lies the problem
Ivan Tomicic
3,873 PointsBut why is is positioned right in mozilla? How can I fix that?
Graham Davidson
Courses Plus Student 14,966 PointsJust having a nose in Illustrator for you
Graham Davidson
Courses Plus Student 14,966 PointsI did think you were going to ask the Mozilla question - honest answer is I dont know but if we fix the Chrome version then the Mozilla one will still have the same result for you - which I am guessing is ok
Ivan Tomicic
3,873 PointsYes, Mozilla is showing it how it should look, her photo on right side and text on left...
Graham Davidson
Courses Plus Student 14,966 PointsSomething to do with sizing issues of the width - try messing about with the width setting as shown below
.imgavatar { position: absolute; right: -40px; bottom: 0px; max-height: 90%; width: 20%;
Ivan Tomicic
3,873 PointsThis almost helped me, only problem I'm having now is with text part, it won't take 100% height unless I tell it to go all the way in width but then it center it again?
Graham Davidson
Courses Plus Student 14,966 PointsIs this a responsive build
Ivan Tomicic
3,873 PointsNot yet, but will be, that is why I'm using svg instead of jpeg...
Graham Davidson
Courses Plus Student 14,966 PointsIm leaving the office shortly but have you had a look over the CSS tricks article on SVG - I have found using the file as an include with php gives more control over it http://css-tricks.com/using-svg/
Ivan Tomicic
3,873 PointsIvan Tomicic
3,873 PointsSure... Here it is
Thank you so much!