Jump to content
s_avinash_s

table alignment

Recommended Posts

Hi 

I have a table as shown https://www.w3schools.com/code/tryit.asp?filename=FW45FU4STHOR

1.Instead of using align=center or right i need to keep the table at 60% of width of web page.

2.I want to make it inline instead of next line.

I tried with display: inline-block; but has no effect

3. i need to update dynamic data in paramter1 to 5.am getting the content changes in pro_parameter1 but how to update in my table

    <p  id="pro_parameter1"></p>
     
    <script>
    var currentUsedFont;
    function pro_parameter1() {

      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) { 
	        
          document.getElementById("pro_parameter1").innerHTML=this.responseText; 
          document.getElementById("pro_parameter1").style.fontSize="25px";
                  
        }
      };
    xhttp.open("GET", "pro_parameter1.txt", true);
    xhttp.send();
    }

    setInterval(pro_parameter1(), 1000);

How to do it.

 

How to proceed

Edited by s_avinash_s
added 3rd point

Share this post


Link to post
Share on other sites

table is a block element by default, to centre a block element it MUST have a width and use margin: 0 auto; on itself.

A table using display: inline-block; acts like centring text would by targeting its parent block element such as  div, p, h1 to h6 and using text-align: center; on those parent block elements.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×