473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to have horizontal space between two boxes?

I created a rectangle using this code:
<div style="width:500px;height:100px;border:1px solid #3D5B9B;">This is a rectangle!</div>

I want to have three such boxes horizontally with white space between them. From the past two hours I have tried every bit of code.

What should I use to have whitespace between the horizontal boxes.
Jun 28 '14 #1
2 10584
Exequiel
288 256MB
try to use css/css3 for neat coding. . you can use margin, margin-top, margin-bottom, margin-left, margin-right property,
example:

Expand|Select|Wrap|Line Numbers
  1. <style>
  2. .horizontal_div
  3. {
  4.   width:500px;
  5.   height:100px;
  6.   border:1px solid #3D5B9B;
  7.   background: #ccc;
  8.   margin: 5px; /*margin-top:5px;*/
  9. }
  10. </style>
  11.  
  12. <div class="horizontal_div">div 1</div>
  13. <div class="horizontal_div">div 2</div>
  14. <div class="horizontal_div">div 3</div>
  15.  
I hope it helps you.
Jun 29 '14 #2
Sherin
77 64KB
Try This Code
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html> 
  2. <html> 
  3.     <head> 
  4.         <title>Space between flexbox</title> 
  5.         <style> 
  6.             .flex2 { 
  7.                 display: flex; 
  8.                 justify-content: space-around; 
  9.                 background-color: green; 
  10.             } 
  11.             .flex3 { 
  12.                 display: flex; 
  13.                 justify-content: space-between; 
  14.                 background-color: green; 
  15.             } 
  16.             .flex-items { 
  17.                 background-color: #f4f4f4; 
  18.                 width: 100px; 
  19.                 height:50px; 
  20.                 margin: 10px; 
  21.                 text-align: center; 
  22.                 font-size: 40px; 
  23.             } 
  24.             h3 { 
  25.                 text-align:center; 
  26.             } 
  27.             .geeks { 
  28.                 font-size:40px; 
  29.                 text-align:center; 
  30.                 color:#009900; 
  31.                 font-weight:bold; 
  32.             }                     
  33.         </style> 
  34.     </head> 
  35.  
  36.     <body> 
  37.         <div class = "geeks">GeeksforGeeks</div> 
  38.         <h3>Space between flexbox</h3> 
  39.  
  40.         <br> 
  41.         <b>justify-content: space-around </b> 
  42.         <div class="flex2"> 
  43.             <div class="flex-items">1</div> 
  44.             <div class="flex-items">2</div> 
  45.             <div class="flex-items">3</div> 
  46.         </div> 
  47.         <br> 
  48.         <b>justify-content: space-between </b> 
  49.         <div class="flex3"> 
  50.             <div class="flex-items">1</div> 
  51.             <div class="flex-items">2</div> 
  52.             <div class="flex-items">3</div> 
  53.         </div> 
  54.         <br> 
  55.  
  56.     </body> 
  57. </html>                                 
  58.  
Jul 24 '20 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ian McCall | last post by:
Hello. How can I make an absolutely-positions div element expand and fill the remaining horizontal space available on-screen? The background is that I've used CSS to create the normal 'three...
8
by: lkrubner | last post by:
Am I wrong, or do paragraphs have extra space on top in FireFox, when compared to Microsoft IE. The top of this page is an example: http://www.publicdomainsoftware.org/index.php?pageId=299 The...
5
by: chuck | last post by:
The browser windows do. Why not the editor windows? I hate to complain but is there any way to get IDLE to run in more of an MDI mode? Having the floating windows everywhere is rather...
2
by: CSDunn | last post by:
Hello, I need to create an Access 2003 ADP report that will require more horizonal space on the report than can be accomodated by a legal paper size in landscape orientation. It would be okay...
2
by: Michael D. Reed | last post by:
I have 2 list boxes and a combo box that are bound to table adaptors. I have another table that has relations with the underlying tables to the adaptors above. I have set this up in a dataset. ...
3
chandru8
by: chandru8 | last post by:
hi guys iam using vb6.0 i need to arrange more than 50 text boxes with a scroll bar is it possible to arrange using vb6.0 or any other alternative please its urgent thanxs
2
by: Onlynewsopleasebenice | last post by:
Hi, I am trying to input a message into a string within my program.... however each time i input a space the program crashes. Here is the code, please help me. #include <iostream> #include...
3
by: buddyr | last post by:
Hello, I was able to use the example on Cascading /List boxes on the site here for 2 combo boxes. http://bytes.com/topic/access/insights/605958-cascading-combo-list-boxes Is there a way to add...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.