How to style webpage with percentages


Tags: html,css

Problem :

Following is my page structure

<div class="webpage">
    <div class="image"><img...></div>
    <div class="text1"></div> <div class="text2"></div>
</div>

What I want is for my webpage to be centrally aligned. That is it should fill all the page in vertical position. But horizontally, it should cover the central 80%.

so I wrote

.webpage{
margin-left : 10%;
margin-right : 10%;
width : 80%;
}

Now, I want my image to cover the top 20% of the area, and for my text 1 and text2 to cover the rest of the bottom 80%, but they should be aligned next to each other. Not vertically, but horizontally. So horizontally I want 50% for text1, and 50 for text 2.

I am not sure how to style it with css.

Can someone please advice

Thanks



Solution :

Please check the fiddle - https://jsfiddle.net/afelixj/tjsoL8dm/

image is added as background.


    CSS Howto..

    How to center align

    How can I show only a section of a video frame with CSS or JavaScript?

    How to use the Xpath and CSS selector in for function

    How to keep a diagonal running background animation without rotating the div?

    How do I specify in HTML or CSS that a table column should have the minimum width

    How do I set the table row heights to minimum except last row?

    How to generate CSS with loop in less

    How to set shadow on top of a CSS border?

    How to add animated gif to an image sprite?

    How to line up lists side by side?

    How to keep height of parent div with absolute positioned img inside?

    How to add css in php file? [closed]

    How to create a jQuery scroll to edit CSS?

    How would I go about making my q and a page like this: http://www.text-link-ads.com/r/faq

    showing a css component for a specified number of seconds

    Section background image showing empty space in bottom [closed]

    CSS: How to fake a :hover state?

    How to apply css for a class within h2?

    Customizing Clockdown.js to Show only Minutes and Seconds

    How to center an element horizontally and vertically?

    div under div - dont know how to do this

    Have element show when .onclick and when the element has focus from tab

    JavaFx: How to get the corresponding stylesheet for a given style class of a Node?

    How to make css jQuery thumbnail slides loop

    Phonegap : how Control the font size of the Mobile?

    How to load dynamic CSS files based on condition

    How to use below css as inline for table row (tr)?

    Showing the selected value on the handler of range input as the value changes

    HTML element positioning - How do I have an element always stay in the visible area without javascript

    How to include a non-standard font-face in azure?