HomeОбразованиеRelated VideosMore From: Filip Delac

How to Vertically Align Text next to an Image

174 ratings | 31494 views
Align those images and text! Perfectly align them next to each other using CSS magical magic :) Project Resources: http://www.mediafire.com/download/raktf1cxje34p17/How_to_vertically_align_text_next_to_an_image.7z Tools: Brackets, FREE code editor http://brackets.io/ Emmet, super speed coding addon http://emmet.io/ Beautify, turning your ugly code into beautiful script https://github.com/brackets-beautify/brackets-beautify Transcription: Hi guys, today we will vertically align text next to an image. So let's do it! First of all, let's import our image. I prepare some image in the description you have project files are in the description, so you can download it. It's a pretty big image but don't worry, it's a just a motherboard. Okay, just let's style these image a bit. We styled this image just say that are image size height. Height to be 100 pixels we just shrink our image, okay? And just added the span element. Span element ,and say this is a text. Okay, as you can see, this is the text is a bit down here and we want to be in the middle. Just and vertically align middle. Ta-da. This is it, guys. Don't go, there are few gems about this, as you can see, this is in in the middle and as you can see these blue is our in-line element. But, for example, what if we want to add our p tag? This is a problem, the problem is here. This p is below the image so if you want to add this p next to our image we just have to do these: Our p tag needs some modification, okay? We add display-inline. And this is it, as you can see if we select this tag. Our p tag acts like an inline element, just like our span element, and because the p tag is the block element, if we remove this, it will go down there. OK, just remove this, but if you say inline-block, it will also be up, but act as a block element as you can see, I can now select only the text. And if I selected this, it's a different, remember : this one here, the big one is inline and this one is a block element. It's a huge difference, and in my tutorial tutorials you can learn what is the difference between inline and block elements, so don't be scared and visit me there, and that's it guys and have a nice day, I hope this, I hope this help you, and bye-bye.
Html code for embedding videos on your blog
Text Comments (47)

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.