Obecnie utworzyłem kolumnę div po dwóch stronach obok siebie po 50% dla każdego elementu div. Próbuję dowiedzieć się, jak zrobić lewe div 70%, a prawo div 30%.Jak dostosować procent szerokości moich dwóch kolumn div?
Ponadto oprócz 2 kolumn div. Jeśli chciałem utworzyć 4-bitowe divy po 25% każda i pięciokolumnowe div po 20% każda. Jak to zrobić?
Oto mój jsfiddle: http://jsfiddle.net/huskydawgs/zhckr47h/3/
Tu jest mój HTML:
<div class="container-2col">
<div class="container-1col">
<div class="col1">
<p>Delicious and crunchy, apple fruit is one of the most popular and favorite fruits among the health conscious, fitness lovers who firmly believe in the concept of “health is wealth.” This wonderful fruit is packed with rich phyto-nutrients that, in the true sense, indispensable for optimal health. Certain antioxidants in apple have several health promoting and disease prevention properties, and thereby, truly justifying the adage, “an apple a day keeps the doctor away.”</p>
</div>
<div class="col2">
<p>Vegetables, like fruits, are low in calories and fats but contain good amounts of vitamins and minerals. All the Green-Yellow-Orange vegetables are rich sources of calcium, magnesium, potassium, iron, beta-carotene, vitamin B-complex, vitamin-C, vitamin-A, and vitamin K.</p>
</div>
</div>
</div>
Here's my CSS:
.container-2col {
clear: left;
float: left;
width: 100%;
overflow: hidden;
background: none;
}
.container-1col {
float: left;
width: 100%;
position: relative;
right: 50%;
background: none;
}
.col1 {
float: left;
width: 46%;
position: relative;
left: 52%;
overflow: hidden;
}
.col2 {
float: left;
width: 46%;
position: relative;
left: 56%;
overflow: hidden;
}
Nie jestem pewien, śledzę, ale co zmienia '.col' szerokości do 64% i' .col2' szerokości do 28%? Podobnie jak [this] (http://jsfiddle.net/zhckr47h/4/)? Ponieważ twoje lewe i prawe są obecnie 46%, to 64% i 28% to ta sama suma (92%), ale mają równowagę 70:30 zamiast 50:50. – lurker
"Jeśli chciałbym utworzyć 4-elementowy element div o wartości 25% i pięciokolumnowy dział o wartości 20%, w jaki sposób powinienem to zrobić?" - to niemożliwe, to 120% szerokości :) – AleshaOleg
70% i 30% wewnątrz znaczka 100% – user3075987