CSS: A guide to creating layouts

I wrote this code snippet to display a table:

<div class="topologyBalloon" id="bl_c2f03b99-6d62-43c4-9a35-4b4cbf22a7db"> 
  <a href="#close" class="closeTopologyBalloon">×</a>
  <div class="contentBody">

    <table class="detailInfoTable">
      <caption>private</caption>
      <tbody>
        <tr>
          <th class="device">ID</th>
          <td>c2f03b99-6d62-43c4-9a35-4b4cbf22a7db</td>
        </tr>
        <tr>
          <th class="device">status</th>
          <td>
            <span class="active">ACTIVE</span>
          </td>
        </tr>
      </tbody>
    </table>

    <table class="detailInfoTable">
      <caption>subnets</caption>
      <tbody>
        <tr>
          <th>
            <span title="cc59732b-4ce8-4aae-bab5-fac80c135440">
              <a href="/dashboard/project/networks/subnets/cc59732b-4ce8-4aae-bab5-fac80c135440/detail">cc59732b-4ce8-4aae-bab5-fac80c135440</a>
            </span>
          </th>
          <td>10.10.10.0/24</td>
        </tr>
    <tr>
          <th>
            <span title="4394b976-f98c-4696-8348-5f6c78a8987e">
              <a href="/dashboard/project/networks/subnets/4394b976-f98c-4696-8348-5f6c78a8987e/detail">4394b976-f98c-4696-8348-5f6c78a8987e</a>
            </span>
          </th>
          <td>10.10.11.0/24</td>
        </tr>
  </tbody>
    </table>

  </div>
  <div class="footer">
    <div class="footerInner">
      <div class="cell link">
        <a href="/dashboard/project/networks/c2f03b99-6d62-43c4-9a35-4b4cbf22a7db/detail">» check detail information</a>
      </div>
    </div>
  </div>
</div>

Here is the CSS that goes with it:

table, th, td{
  border: 0px solid blue;
}

caption {
    font-weight: bold;
}

th {
    color: #D0D0D0;
}

.active {
    display:block;
    margin-right:5px;
    border-radius:10px;
    width:9px;
    height:9px;
    background-color:#ff6f0b
}

You can see how it looks here.

If you want to indent the tables and add a line to separate them like in the images below, you can follow these instructions:

https://i.sstatic.net/NxylV.jpg

Answer №1

If you're looking for a solution similar to this one, check it out:

table, th, td{
  border: 0px solid blue;
}

caption {
    font-weight: bold;
    text-align: left
}

th {
    color: #D0D0D0;
}


.active::before {
  content: " ";
  display:inline-block;
  border-radius:10px;
  width:9px;
  height:9px;
  background-color:#ff6f0b;

}
<div class="topologyBalloon" id="bl_c2f03b99-6d62-43c4-9a35-4b4cbf22a7db"> 
  <a href="#close" class="closeTopologyBalloon">×</a>
  <div class="contentBody">

    <table class="detailInfoTable">
      <caption>private</caption>
      <tbody>
        <tr>
          <th class="device">ID</th>
          <td>c2f03b99-6d62-43c4-9a35-4b4cbf22a7db</td>
        </tr>
        <tr>
          <th class="device">status</th>
          <td>
            <span class="active">ACTIVE</span>
          </td>
        </tr>
      </tbody>
    </table>
<HR/>
    <table class="detailInfoTable">
      <caption>subnets</caption>
      <tbody>
        <tr>
          <th>
            <span title="cc59732b-4ce8-4aae-bab5-fac80c135440">
              <a href="/dashboard/project/networks/subnets/cc59732b-4ce8-4aae-bab5-fac80c135440/detail">cc59732b-4ce8-4aae-bab5-fac80c135440</a>
            </span>
          </th>
          <td>10.10.10.0/24</td>
        </tr>
    <tr>
          <th>
            <span title="4394b976-f98c-4696-8348-5f6c78a8987e">
              <a href="/dashboard/project/networks/subnets/4394b976-f98c-4696-8348-5f6c78a8987e/detail">4394b976-f98c-4696-8348-5f6c78a8987e</a>
            </span>
          </th>
          <td>10.10.11.0/24</td>
        </tr>
  </tbody>
    </table>

  </div>
  <div class="footer">
    <div class="footerInner">
      <div class="cell link">
        <a href="/dashboard/project/networks/c2f03b99-6d62-43c4-9a35-4b4cbf22a7db/detail">» explore further details</a>
      </div>
    </div>
  </div>
</div>

Answer №2

If you're looking to style your table, consider using the following CSS:

table, th, td{
  border: 0px solid blue;
}

caption {
    font-weight: bold;
}

th {
    color: #D0D0D0;
}

.active {
  display:block;
}
.active::before {
  content: " ";
  display:inline-block;
  border-radius:10px;
  width:9px;
  height:9px;
  background-color:#ff6f0b;
  margin-right:5px; 
}
.topologyBalloon {
  background: #fff;
  border:1px solid #ccc;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  border-radius: 5px;
  padding: 15px;
  position:relative;
  margin-left:10px;
}
.topologyBalloon:before,
.topologyBalloon:after {
  content:"";
  width: 0; 
  height: 0; 
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;   
  border-right:10px solid #fff; 
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  z-index:2;
}
.topologyBalloon:after {
  border-right-color:#ccc;
  left:-11px;
  z-index:1;
}
.closeTopologyBalloon {
  float: right; 
}
caption {
  text-align: left;
}
.detailInfoTable {
  border-bottom :1px solid #ccc;
  margin-bottom:10px;
}
.detailInfoTable td {
  padding:5px;
}
<div class="topologyBalloon" id="bl_c2f03b99-6d62-43c4-9a35-4b4cbf22a7db"> 
  <a href="#close" class="closeTopologyBalloon">×</a>
  <div class="contentBody">
    <table class="detailInfoTable">
      <caption>private</caption>
      <tbody>
        <tr>
          <th class="device">ID</th>
          <td>c2f03b99-6d62-43c4-9a35-4b4cbf22a7db</td>
        </tr>
        <tr>
          <th class="device">status</th>
          <td>
            <span class="active">ACTIVE</span>
          </td>
        </tr>
      </tbody>
    </table>

    <table class="detailInfoTable">
      <caption>subnets</caption>
      <tbody>
        <tr>
          <th>
            <span title="cc59732b-4ce8-4aae-bab5-fac80c135440">
              <a href="/dashboard/project/networks/subnets/cc59732b-4ce8-4aae-bab5-fac80c135440/detail">cc59732b-4ce8-4aae-bab5-fac80c135440</a>
            </span>
          </th>
          <td>10.10.10.0/24</td>
        </tr>
        <tr>
          <th>
            <span title="4394b976-f98c-4696-8348-5f6c78a8987e">
              <a href="/dashboard/project/networks/subnets/4394b976-f98c-4696-8348-5f6c78a8987e/detail">4394b976-f98c-4696-8348-5f6c78a8987e</a>
            </span>
          </th>
          <td>10.10.11.0/24</td>
        </tr>
      </tbody>
    </table>
  </div>
  <div class="footer">
    <div class="footerInner">
      <div class="cell link">
        <a href="/dashboard/project/networks/c2f03b99-6d62-43c4-9a35-4b4cbf22a7db/detail">» check detail information</a>
      </div>
    </div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

ng-repeat and $scope problem

I am having an issue with my page where I display 3 images in a row using Ng-repeat. When I click on any image, it only shows the first image that was displayed in that particular row. Template: <div id="galscrolldiv" class="row" ng-repeat="image in i ...

Create a visual representation using a push button

Hey there, I'm attempting to create an image using a button on canvas. However, I'm facing an issue where I can't draw on the clear canvas. Here's my code: <!doctype html> <html> <head> <meta charset="utf-8"> ...

Navigating Between Web Pages

Hello there! I'm curious to learn how I can establish routing between multiple pages. Specifically, I have an index page and I'd like to navigate to other HTML pages within my views folder. Is it possible to achieve this without relying on the An ...

What is the best way to retrieve the value of the selected mat-option?

I've been struggling to extract the selected value of a mat-option using this specific HTML and TypeScript code. html <mat-form-field appearance="outline" floatLabel="always"> <mat-label>TRA Type</mat-label> ...

Unable to completely conceal the borders of Material UI Cards

Despite my efforts to blend the card with the background, I am still struggling with the tiny exposed corners. I've spent hours searching for a solution, but nothing seems to work. I've tried various methods such as adjusting the border radius in ...

Locate the data attribute and store it in the database using an ajax request

I am in need of a proper script to insert a data attribute into the database upon clicking using ajax. HTML: <li><a data-cat="random name">Button</a></li> jQuery: $('li a').click(function() { $(this).data('cat&a ...

Show values in an angular template using an array

I want to showcase values of an array using *ngFor const blockData = [ {text: sampleText1, array: [val1]}, {text: sampleText2, array: [val2, dat2]}, {text: sampleText3, array: [val3, dat3]} ] <div *ngFor="let data of blockData"> ...

A guide on showing an image encoded in base64 within an HTML document

I obtained the image URL and proceeded to download the image which was then converted into base 64 using an online converter. Here is the base 64 code: iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d... Can I now utilize this large size im ...

Is it possible to manipulate elements within an overflow container using JavaScript/jQuery when using the HTML style "overflow:hidden"?

My <div> has a styling of style="overflow:hidden" and the size of the <body> is fixed, intended as a multi-screen display without a user interface. Is there a method to access these "invisible" elements to identify the first one that exceeds t ...

Suggestions for activating a particular accordion divider?

I've come across a seemingly simple question that has been causing me some trouble. I am attempting to expand, open, or collapse a specific accordion panel, but have not been able to find an answer so far. Let's say I have three panels identified ...

Breaking the page with HTML and CSS

* { box-sizing: border-box; } .row { display: flex; } /* Creating two equal columns that sit side by side */ .column { flex: 50%; padding: 10px; } div.row { page-break-after: always; } <body> <div<div class="row"> ...

I'm struggling to understand how to insert the JSON response into an HTML element

I am encountering an issue with my code where the response from the API call is not displaying on the HTML page. I'm unsure why it's not showing up even though the page loads successfully. <!DOCTYPE html> <html> <head> <title ...

I'm curious about where to find more information on this new technology called the 'scroll to page' feature

Recently, I came across a captivating website feature that caught my eye. As someone relatively new to front end web development, I am intrigued by the scrolling technique used on this site. I'm specifically drawn to the 'page to page' scro ...

Calculate the total count of responses within the JSON data returned

Hello all, I need some guidance on calculating the total number of responses in a JSON response that adhere to a specific rule using JavaScript. Here is the JSON response that I am discussing: [ { "InvoiceNumber":"INV0319", "InvoiceOrd ...

Struggling to grasp the concept of fit-content? Let me

For my personal project, I am creating a simple react webpage. To incorporate zoom capabilities, I decided to use the library called React-zoom-pan-pinch. Initially, without implementing this library, my SVG element filled the screen in red, which was the ...

Angular 8 carousel featuring a dynamic bootstrap 4 design with multiple images and cards displayed on a single slide

I am currently working on a dynamic carousel that should display multiple cards or images in one row. Initially, I faced an issue with the next and previous buttons not functioning properly when trying to display multiple cards in one row. After some onlin ...

Angular4: The Process of Iterating Through an Array of Objects within an Object

I'm struggling to iterate through an Object that contains an array of objects within an anchor tag. Here's how my code is structured: {"1":{"uri":"test1","name":"test1","icon":"http:\/\/dummyurl\/images\/icons\/test1-ico ...

Switching Grid 1 and 2 in Bootstrap 4

Here is an example of what I need: Image: https://i.sstatic.net/EPCAq.png This is the code I am using: <div class="container"> <div class="row"> <div class="col-3"> <img src="image1.png" class="i ...

"Customize your WordPress theme by moving the sidebar from left to right for

Currently, I am utilizing the flat theme sourced from . In an attempt to customize the appearance, I made modifications within style.css: #page:before, .sidebar-offcanvas, #secondary {float: right !important;} However, this adjustment only applies to a ...

Adjust Title Padding Specifically for Mobile Devices

When viewing my blog page on mobile, I noticed that the titles of my blog posts are overlapping with the teasers. To fix this issue, I attempted to add margins to the bottom of the post titles specifically for mobile: https://i.stack.imgur.com/BHi3C.png H ...