rj1102 Posted February 5, 2016 Share Posted February 5, 2016 I could not find a seperate W3.CSS forum, so I've posted my question here. See html output below: Using w3-half, how can I achieve that the white space under the green div is also filled with green (or the silver div filled out with silver if this div happens to be the shortest, the text is dynamic)? Code: <div class="w3-content"> <div class="w3-row" style="background-color: yellow"> <p>Test</p> </div> <div class="w3-row"> <div class="w3-half" style="background-color: silver"> <p>[w3-half] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </div> <div class="w3-half" style="background-color: green"> <p>[w3-half] Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> </div> <div class="w3-row" style="background-color: yellow"> <p>Test</p> </div> </div> Link to comment Share on other sites More sharing options...
dsonesuk Posted February 5, 2016 Share Posted February 5, 2016 (edited) <!DOCTYPE html> <html> <title>W3.CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css"> <style> .bg-setting .w3-half{position: relative;} .bg-setting .w3-row {overflow: hidden;} .bg-setting .w3-half:before {content: ""; position: absolute; top: -50%; left:0; height: 500%; right:0; z-index: -1;} .yellow {background-color: yellow;} .bg-setting .w3-half.silver:before {background-color: silver;} .bg-setting .w3-half.green:before {background-color: green;} </style> </head> <body> <div class="w3-content bg-setting "> <div class="w3-row yellow"> <p>Test</p> </div> <div class="w3-row"> <div class="w3-half silver"> <p>[w3-half] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </div> <div class="w3-half green"> <p>[w3-half] Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> </div> <div class="w3-row yellow"> <p>Test</p> </div> </div> </body> </html> Edited February 5, 2016 by dsonesuk Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now