Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <style> #parent { height: 300px; border: 1px solid #1c87c9; } #floater { float: left; width: 100%; height: 50%; margin-bottom: -50px; } #child { clear: both; height: 100px; background: #8ebf42; } </style> </head> <body> <h1>Example of vertically aligned text with CSS float property:</h1> <div id="parent"> <div id="floater"></div> <div id="child"></div> </div> </body> </html>