CSS

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentCSS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old March 29th, 2018, 09:37 PM
jonobugs jonobugs is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Mar 2018
Posts: 0 jonobugs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 56 sec
Reputation Power: 0
CSS DIV layout

I understand that the DIV layout goes across horizontally in rows like this:

1 2
3 4
5 6
7 8


However, I was wondering how I would be able to layout the divs when one is larger than the others. I want to have 2 columns and in the first column I want three divs, and in the second column 5 divs.

So in this example, div 3 would take up 3 lines. How would I go about doing that? I can do it with absolute positioning, but I want to do it without absolute positioning

1 2
3 4
3 5
3 6
7 8

I have the following style sheet which uses absolute positioning that gives me the look I want, but like I said, I want to be able to take out the absolute positioning. Unfortunately, without that my boxes go all over the place!

I am struggling with the float and clear commands. I kind of understand it, but I can't seem to predict what will happen most of the time. I think I'm having problems because the DIV in the #3 position (as indicated above) is larger and it seems I can only put one div to the right of that one.

If anyone can let me know how I can put 3 divs to right of just ONE large div, I would be very grateful.


Code:
        <style>
		
		[class*="col-"] {
			float: left;
			padding: 15px;
			border: none;
		}
		
		.row::after {
			content: "";
			clear: both;
			display: table;
		}
		
	
            body {
                font-family: comic sans ms, sans-serif;
				background-image: url("background.jpg");
                background-color:  green;

            }
			
			@media only screen and (max-width: 600px) {
			body {
				background-color: lightblue;
				background-image: none;
			}
		}
			
			.col-1 {width: 8.33%;}
			.col-2 {width: 16.66%;}
			.col-3 {width: 25%;}
			.col-4 {width: 33.33%;}
			.col-5 {width: 41.66%;}
			.col-6 {width: 50%;}
			.col-7 {width: 58.33%;}
			.col-8 {width: 66.66%;}
			.col-9 {width: 75%;}
			.col-10 {width: 83.33%;}
			.col-11 {width: 91.66%;}
			.col-12 {width: 100%;}
            form {
                font-size: 1.2em;
            }
			
			@media only screen and (max-width: 768px) {
				/* For mobile phones: */
				[class*="col-"] {
					width: 100%;
				}
			}
            
            #text {
                background-color: wheat;
                width: 150px;
                height: 25px;
                color: blue;
                font-size: 1em;
                
            }
            
			.SoundBite {
                float: left;
				clear: none;
				position: absolute;
				top: 85px;
				left: 100px;
				padding: 5px;
                background: darkblue;
                color: white;
                max-height: 180px;
				line-height: 180px;
                max-width: 200px;
                border-radius: 50px;
                margin: auto;
                text-align: center;
                vertical-align: middle;
                font-size: 5em;
			}
			
			.SoundBite:hover {
				background-color: darkgreen;
				cursor: pointer;
			}

			.Score {
                float: right;
				clear: none;
				position: absolute;
				top: 20px;
				left: 100px;
				padding: 5px;
                background: darkblue;
				border-color: pink;
				border: 5px;
				opacity: 0.8;
                color: white;
                height: 45px;
                max-width: 200px;
                border-radius: 50px;
                margin: auto;
                text-align: center;
                vertical-align: middle;
                font-size: 2em;
				pointer-events: none;
			}			
			
			.KitchenTimer {
                float: right;
				clear: none;
				position: absolute;
				top: 290px;
				left: 100px;
				padding: 5px;
                background: darkblue;
				border-color: pink;
				border: 5px;
				opacity: 0.8;
                color: white;
                height: 45px;
                max-width: 200px;
                border-radius: 50px;
                margin: auto;
                text-align: center;
                vertical-align: middle;
                font-size: 2em;
				pointer-events: none;
			}			
			
			
			.Answer {
				position: absolute;
				color: white;
				height: 45px;
				max-width: 120px;
				left: 400px;
				padding: 5px;
				border-radius: 25px;
				margin: auto;
				text-align: center;
				vertical-align: middle;
				font-size: 2em;
				background-color: darkblue;
			}
			
			.AnswerCorrect {
				position: absolute;
				color: white;
				height: 45px;
				left: 400px;
				max-width: 120px;
				padding: 5px;
				border-radius: 25px;
				margin: auto;
				text-align: center;
				vertical-align: middle;
				font-size: 2em;
				background-color: green;			
			}
			
			.Answer:hover {
				background-color: blue;
				cursor: pointer; 
				
			}
			
			.AnswerWrong {
				position: absolute;
				color: white;
				height: 45px;
				left: 400px;
				max-width: 120px;
				padding: 5px;
				border-radius: 25px;
				margin: auto;
				text-align: center;
				vertical-align: middle;
				font-size: 2em;
				background-color: red;
			}
			
			#Answer1 {
				top: 20px;
			}
			#Answer2 {
				top: 85px;
			}
			#Answer3 {
				top: 150px;
			}
			#Answer4 {
				top: 220px;
			}
			
			#Answer5 {
				top: 290px;
			}
			

        </style>
    </head>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <body>
	
	<audio id="audio" src="audio/tryAgain.mp3" autostart="false" ></audio>
	<audio id = "win" src="audio/win.mp3" autostart = "false"></audio>
	<audio id = "lose" src = "audio/lose.mp3" autstart = "false"></audio>
	
    <a onclick="playSound();"><div span class="col-3 SoundBite"><i class="fa fa-file-sound-o" id="audio" src="audio/tryAgain.mp3" autostart="false" style="font-size:64px;color:skyblue"></i></div></a>
	<a onclick ="checkAnswer = 1; check();"><div class = "col-2 Answer" id="Answer1">1</div>
	<a onclick ="checkAnswer = 2; check();"><div class = "col-2 Answer" id="Answer2">2</div>
	<a onclick ="checkAnswer = 3; check();"><div class = "col-2 Answer" id="Answer3">3</div>
	<a onclick ="checkAnswer = 4; check();"><div class = "col-2 Answer" id="Answer4">4</div>
	<a onclick ="checkAnswer = 5; check();"><div class = "col-2 Answer" id="Answer5">5</div>
	<div class = "col-3 Score">Score</div>
	<a onclick ="location.reload();"><div class = "col-3 KitchenTimer">Start</div>

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentCSS > CSS DIV layout


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap