Creating CSS3 Circles connected by lines

Creating CSS3 Circles connected by lines

To create CSS3 circles connected by lines, you can use a combination of HTML and CSS. Here's an example:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; } .circle { width: 50px; height: 50px; background-color: #3498db; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; } .line { position: absolute; border: 2px solid #3498db; width: 100px; /* Adjust the line length */ height: 2px; } .line1 { top: 25px; left: 50px; transform: rotate(45deg); } .line2 { top: 50px; left: 25px; transform: rotate(-45deg); } .line3 { top: 50px; left: 75px; transform: rotate(135deg); } </style> </head> <body> <div class="circle">A</div> <div class="line line1"></div> <div class="circle">B</div> <div class="line line2"></div> <div class="circle">C</div> <div class="line line3"></div> <div class="circle">D</div> </body> </html> 

In this example:

  • Each circle is represented by the .circle class.
  • The lines connecting the circles are represented by the .line class.
  • Adjust the width, height, and color properties to fit your design.
  • The transform: rotate() property is used to set the angle of the lines.
  • You can add more circles and lines as needed.

This example is a simplified representation, and you may need to adjust the positioning, sizes, and colors based on your specific requirements.

Examples

  1. "CSS3 circles connected by lines"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background-color: #3498db; border-radius: 50%; position: absolute; } .line { width: 2px; height: 100px; background-color: #3498db; position: absolute; left: 50%; transform: translateX(-1px); } 
  2. "CSS3 circles with connecting lines responsive"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 10vw; height: 10vw; background-color: #e74c3c; border-radius: 50%; position: absolute; } .line { width: 2px; height: 20vw; background-color: #e74c3c; position: absolute; left: 5vw; transform-origin: 50% 0; transform: translateX(-1px); } 
  3. "CSS3 connecting circles animation"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background-color: #2ecc71; border-radius: 50%; position: absolute; animation: pulse 1s infinite alternate; } .line { width: 2px; height: 100px; background-color: #2ecc71; position: absolute; left: 50%; transform: translateX(-1px); } @keyframes pulse { from { transform: scale(1); } to { transform: scale(1.1); } } 
  4. "CSS3 circles with connecting lines hover effect"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background-color: #f39c12; border-radius: 50%; position: absolute; transition: transform 0.3s; } .line { width: 2px; height: 100px; background-color: #f39c12; position: absolute; left: 50%; transform: translateX(-1px); transition: transform 0.3s; } .circle:hover, .line:hover { transform: scale(1.2); } 
  5. "CSS3 circles with connecting lines and labels"

    • Code Implementation:
      <div class="circle"> <span>1</span> </div> <div class="line"></div> <div class="circle"> <span>2</span> </div> 
      .circle { width: 50px; height: 50px; background-color: #9b59b6; border-radius: 50%; position: absolute; display: flex; align-items: center; justify-content: center; color: white; } .line { width: 2px; height: 100px; background-color: #9b59b6; position: absolute; left: 50%; transform: translateX(-1px); } 
  6. "Responsive CSS3 circles connected by lines"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 10%; height: 10%; background-color: #3498db; border-radius: 50%; position: absolute; } .line { width: 1%; height: 20%; background-color: #3498db; position: absolute; left: 5%; transform: translateX(-0.5%); } 
  7. "CSS3 connecting circles with dashed lines"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background-color: #3498db; border-radius: 50%; position: absolute; } .line { width: 2px; height: 100px; background-color: #3498db; position: absolute; left: 50%; transform: translateX(-1px); border-left: 2px dashed #3498db; } 
  8. "CSS3 circles connected by lines with different colors"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background-color: #e74c3c; border-radius: 50%; position: absolute; } .line { width: 2px; height: 100px; position: absolute; left: 50%; transform: translateX(-1px); } .line::before { content: ''; display: block; width: 100%; height: 100%; background-color: #e74c3c; } 
  9. "CSS3 circles with connecting lines gradient effect"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background: radial-gradient(circle, #2ecc71, #27ae60); border-radius: 50%; position: absolute; } .line { width: 2px; height: 100px; position: absolute; left: 50%; transform: translateX(-1px); background: linear-gradient(to bottom, #2ecc71, #27ae60); } 
  10. "CSS3 circles with connecting lines shadow effect"

    • Code Implementation:
      <div class="circle"></div> <div class="line"></div> <div class="circle"></div> 
      .circle { width: 50px; height: 50px; background-color: #f39c12; border-radius: 50%; position: absolute; box-shadow: 0 0 10px rgba(243, 156, 18, 0.8); } .line { width: 2px; height: 100px; position: absolute; left: 50%; transform: translateX(-1px); background-color: #f39c12; box-shadow: 0 0 10px rgba(243, 156, 18, 0.8); } 

More Tags

vue-cli geospatial char lottie area filesize sql-server-2008 missingmethodexception w3c gzip

More Programming Questions

More Genetics Calculators

More Math Calculators

More Date and Time Calculators

More Livestock Calculators