Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:42:33+00:00 2026-06-17T06:42:33+00:00

I have two pages with almost the same code. Both have this CSS code

  • 0

I have two pages with almost the same code. Both have this CSS code and the two divs:

<style type="text/css">
.visfarve { position:relative; float:left; padding:5px; border:1px solid #666; }
.farver { border:1px solid black; width:75px; height:10px; }
.valgtfarve { width:95px; height:15px; display:block; background-color:white; text-align:center; }
</style>

<div id="vis" style="display:block; font-size:11px;">
  <a href="javascript:colors(1);">Vis farver</a>
</div>
<div id="skjul" style="display:none; font-size:11px;">
  <a href="javascript:colors(0);">Skjul farver</a>
</div>

One page then has this construct:

<table style="width:730px;">
  <tr>
    <td width="510px">
      <div id="visfarve" style="display:none; margin-top:11px;">&npsp;</div>
    </td>
    <td id="viser" style="border-radius:10px; width:220px; height:inherit"></td>
  </tr>
</table>

The other page has this obstruction:

<div id="visfarve" style="display:none; margin-top:11px;">&nbsp;</div>
<div id="viser" style="margin-top:50px; border-radius:10px; display:none;">&nbsp;</div>

They share these two js functions:

var farve1 = ["3D3D34","463834","3F383D","433839","333F44","3B3B40","38413D","304344","483C33","313F48","37463B","35453F"];
var farve2 = ["S8505-Y20R","7812-Y87R","S8010-R30B","S8010-R10B","8108-R93B","8207-R38B","S8502-G","S8010-B30G","S8010-Y70R","S8010-R90B","S8010-G10Y","S8010-B90G"];

function colors(vis) {
  var setheight = 0;
  for(i=farve1.length-1;i>-1;i--) { skriv += "<div class='visfarve' onmouseover=\"document.getElementById('viser').style.background = '#" + farve1[i] + "';\" onmouseout=\"document.getElementById('viser').style.background = 'white';\" onclick='valgtfarve(\"" + farve2[i] + "\",\"#" + farve1[i] + "\");'><table><tr><td class='farver' title='Klik for at vælge' style='background-color:#" + farve1[i] + ";'></td></tr><tr><td><p>" + farve2[i] + "</p></td></tr></table></div>"; setheight += 10; }
  document.getElementById('visfarve').innerHTML = skriv;

  if(vis) { 
    document.getElementById('vis').style.display = "none";
    document.getElementById('skjul').style.display = "block"; 
    document.getElementById('visfarve').style.display = "block";
    document.getElementById('viser').style.display = "block";
    document.getElementById('viser').style.height = setheight + "px";
  }
  else {
    document.getElementById('vis').style.display = "block";
    document.getElementById('skjul').style.display = "none";
    document.getElementById('visfarve').style.display = "none";
    document.getElementById('viser').style.display = "none";
    document.getElementById('viser').style.height = 0 + "px";
  }
}

function valgtfarve(kode, farve) {
  if(!valgt) { 
    if(confirm("Tones en maling kan den ikke returneres.\nAccepter fraskrivelse af returret for tonet maling?")) { valgt = true; } 
    else {
      document.getElementById('vis').style.display = "block";
      document.getElementById('skjul').style.display = "none";
      document.getElementById('viser').style.height = "0px";
      document.getElementById('visfarve').style.display = "none"; return false;
    }}
  document.getElementById('valgtfarve').value = kode;
  document.getElementById('valgtfarve').style.backgroundColor = farve;
}

When I use the div construct the floating divs lies niceley next to each other with 5 divs in each line and breaks when the container div edge is reached. However, inside the td the divs insists on each having the full width of the td – resulting in only one div per line.

How do I get divs inside a td to keep width and float left?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:42:34+00:00Added an answer on June 17, 2026 at 6:42 am

    Let’s start from a jsFiddle link : Here

    I think it’s a good practice when you post question.

    Please explain where is the problem, in the jsfiddle page I don’t see your bug.

    I did only little modification, no relevant code changes.
    I only defined the variable

    var skriv = "";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two pages, test1.aspx and test2.aspx test1.aspx has this protected void Page_Load(object sender,
I have tried this for almost two days, and it doesn't work, i have
I have two pages that are almost identical. However on the second page the
I have two pages, one that edits user information, and one that edits information
I have two pages, NonMember.aspx and Member.aspx. If a user comes to the site,
I have two pages, A and B. I want to echo a variable written
I have two pages and I want to pass data to each other. How
I have two pages, on the first page after an event happens I change
I have two pages. First one we open with $_POST variables in its url,
I have two pages that inherit from one master page, First.aspx or second.aspx. Navigation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.