Grid-based timekeeping design

Currently working on a clock grid layout and seeking some advice on the next steps. The layout has been created but still needs some adjustments to achieve perfection. What would be the most effective approach for correcting it? Would offsetting it using absolute positioning work or is there another method that would be more suitable? Additionally, I'm looking to resize the entire clock to 29 cm and then use printElement.js (I believe) to print it on A3 paper with padding around the edges for cutting purposes. Visit this link for reference.

    <div class="container">
        <div class="row">
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
            <!-- 12 -->
            <div class="col-1-7 clock-number-12"><img src="img/placeholder.png"></div>
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
        </div>
        <div class="row">
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
            <!-- 11 -->
            <div class="col-1-7 clock-number-11"><img src="img/placeholder.png"></div>
            <div class="col-1-7">&nbsp;</div>
            <!-- 1 -->
            <div class="col-1-7 clock-number-1"><img src="img/placeholder.png"></div>
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
        </div>
        <div class="row">
            <div class="col-1-7">&nbsp;</div>
            <!-- 10 -->
            <div class="col-1-7 clock-number-10"><img src="img/placeholder.png"></div>
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
            <div class="col-1-7">&nbsp;</div>
            <!-- 2 -->
            <div class="col-1-7 clock-number-2"><img src="img/placeholder.png"></div>
            <div class="col-1-7">&nbsp;</div>
        </div>

   //rest of the code here...

CSS:

.col-1-7 {
  width: 14.28571428%;
  float: left;
}

Answer №1

If you're looking for an alternative to adjusting row widths and negative image margins, consider using javascript/jquery:

<div id="clock"></div>

<script src="jquery.printElement.js"></script>
<script>
$(document).ready(function(){
    var tx = 300; //distance from #clock == defines the clock size
    for(var i=-60; i<300; i+=30){ //-60 > 300 = to start the process from HOUR 1
        var rad = i * (Math.PI/180);
        var x = tx*Math.cos(rad);
        var y = tx*Math.sin(rad);
        $('#clock').append("<img src='img/placeholder.png' style='left:"+x+"px;top:"+y+"px'>");
    }

    $("#clock").printElement({
        printMode:'popup',
        leaveOpen:true,
        overrideElementCSS:[
            'clock.css'
        ]
    });
});
</script>

You can include styles like this in a clock.css file:

#clock{
    position: absolute;
    left: 50%;
    top: 50%;
}

img{
    width: 50px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
}

In your actual HTML page, you have the flexibility to apply different styling as overrideElementCSS will take precedence over any CSS included on the page itself.

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

Create a dynamic HTML design with a resizable left panel and a static right panel. The left panel should not wrap text and display ellipsis if necessary

I am looking to display items in a list with a specific format: |Name | Some other val1| |Very very long no wrap line that...| Some other val2| The right side needs to have a fixed width. The left side should fill al ...

Breadcrumb floating to the right, yet it still manages to obstruct other content, forcing it into a

Within the Breadcrumbs section, I have the path home/profile The desired layout involves floating the Breadcrumbs to the right while keeping the Other contents unfloated to the left. Ver1 -------------------- home/profile -------------------- Ot ...

What are the steps to create a CSS grid like this?

Any suggestions on how to create a grid template similar to the image shown in this picture? I am looking to achieve this design without rounded borders and without any gaps between the elements. ...

Clicking on Google Code Prettify does not trigger syntax highlighting

I utilize Google Code Prettify for syntax highlighting my code. Below is the HTML snippet I use: <head> <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> </head> <body> ...

"The JavaScript code included in the index.html file is not functioning as expected when called in the main.js file within a

Here is the index.html code for a simple VueJS app that includes a widget from netvibes.com. The widget code is added in the html file and functioning properly. <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC " ...

Customizing Material UI: Grouping Tab components within a div container

How can I wrap the children of a Material UI Tabs component in divs? <Tabs value={value} indicatorColor="primary" textColor="primary" onChange={handleChange} > <div> <Tab label="x" /> ...

Submitting documents via jQuery post

I am facing an issue with my HTML form where I am trying to upload an image file. After submitting the form, I use JavaScript to prevent the default action and then make a jQuery post request (without refreshing the page) with the form data. However, despi ...

Utilizing Vue's v-for directive to manipulate data through custom looping

When I loop through my data using v-for, I find myself unsure of how to display the data with a custom looping method, such as using modulus. I aim to display the data in groups of three items, assigning a different class to every 3 items. The desired st ...

Taking steps when a number is enclosed within a span

Testing a simple code with similar action to what I want. Apologies for any language errors, hoping to be understood :-) The HTML code snippet: <div class="pagination"> <a href="#" class=""><span>1</span></a> <a href=" ...

The overflow property is not functioning as anticipated

I've browsed Google and this site, but I couldn't find a solution to my issue. On my webpage, I have a shoutbox and a teamspeak viewer with a specific height for the outer div. The scrollbars don't look good on our new design, so I attempt ...

Coloring a table in vue.js based on performance rankings

I'm facing an issue with sorting my data performance in vue js. Here is the script I have created so far: <template> <div> <div class="row"> <h2> Campaign Performance </h2> <table class=&q ...

Managing a fixed footer in an Android webview to prevent it from obstructing an input field when the soft keyboard appears

I am working with a webview that contains a React app, not React Native. The webview features a login page with two input fields and a fixed footer. However, when one of the input fields is focused, the footer moves up and covers part of the input field, ...

Guide on duplicating an HTML page with a button click

How can I duplicate HTML in a new tab when the following buttons are clicked: btn_change_folder_style_seg btn_change_folder_style_raw The content will be: <img src="./pic/web_show/3_seg/01.jpg" alt=""> <img src="./pic/web_show/3_seg/02.jpg" al ...

Tips on utilizing Blazorise's numeric edit group with grouping functionality

I recently attempted to utilize the numeric edit group separating attribute in Blazorise but encountered issues. According to the documentation, it should be possible to use this feature, however, my attempts were unsuccessful. I would greatly appreciate ...

An issue with type conversion arises in Visual Basic when trying to access data from an HTML

I'm currently working with an HTML table that allows for dynamically adding and deleting rows with text-input's in the cells using JavaScript. Instead of ASP.NET TextBox controls, I am sticking to traditional HTML because I believe rows containin ...

Safari's problem with auto-filling forms

I am in the process of designing a payment form. I need to have the fields for credit card number and its expiry date set to autofill. The Chrome browser is functioning correctly, but Safari is not recognizing the expiry_date field for autofill. Below are ...

Bootstrap tab toggle feature

I'm currently facing an issue with Bootstrap's tab component. I need help figuring out how to hide a lorem ipsum section and show a hidden div when a specific tab is clicked, and then revert the changes when a different tab is selected. $(func ...

React Href is not functioning as expected in relative paths

Recently, I delved into React apps and managed to create one with a router. Everything was smooth sailing in dev mode until I tried running index.html from the build folder after npm run build. It seems like all the href links are broken. I suspect somethi ...

Why hasn't the string been properly encoded?

Consider the scenario below: string text = "this is an example of formatted \"string\""; When I display this as a plain string in my web API method: return Ok(text) it will output: this is an example of formatted "s ...

I am currently facing a challenge with Bootstrap, as I am trying to design a webpage for small devices using a 1:4:1 format, but I am struggling to get it right

column 1 and column 3(left and right cols) have successfully passed the test case, but not column 2 (the middle one) that I have commented on in the code. Please help. Thank you. The problem has certain conditions that would have been easier to understa ...