html - Text and image side by side -



html - Text and image side by side -

here total stripped-back code. can see why image , text won't align? ideas?

question edited

here total stripped-back code. can see why image , text won't align? ideas?

class="snippet-code-css lang-css prettyprint-override">body { font-family: 'roboto', sans-serif; color: #fff; } img { max-width: 100%; border-radius: 15px 15px; } .about { background-color: #2c0242; padding: 30px; vertical-align: middle; margin-top: 20px; display: inline-block; } h2, p, img { display: inline-block; margin: 0px; vertical-align: middle; } class="snippet-code-html lang-html prettyprint-override"><!doctype html> <html> <head> <meta charset="utf-8"> <title>bms</title> <link href='http://fonts.googleapis.com/css?family=roboto:400,700,400italic' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="customise.css"> </head> <body> <div class="about"> <h2>about us</h2> <p>blah blah blah.</p> <img src="http://blog.grio.com/wp-content/uploads/2012/09/stackoverflow.png" alt="bikedark" class="icondetails"> </div> <!--all other content contained in comment--> </body> </html>

simple approach create of them(h1, p) display: inline-block;

or can add together float: left; h1 , p

i have aligned them in middle, remove remove vertical-align: middle;

class="snippet-code-css lang-css prettyprint-override">img { max-width: 100%; border-radius: 15px 15px; } .about { background-color: #2c0242; padding: 30px; vertical-align: middle; margin-top: 20px; display: inline-block; } h2, p, img { display: inline-block; margin: 0px; vertical-align: middle; } class="snippet-code-html lang-html prettyprint-override"><div class="about"> <h2>title</h2> <p>text</p> <img src="http://blog.grio.com/wp-content/uploads/2012/09/stackoverflow.png" alt=""> </div>

html css-float

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -