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 7494299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:27:00+00:00 2026-05-29T17:27:00+00:00

Can someone tell me what i am doing wrong here? I want the boxes

  • 0

Can someone tell me what i am doing wrong here? I want the boxes to be the EXACT same width between both divA and divB. Just because divB box has slightly longer text in ‘p2’ should not change the width of the entire box. I don’t want to use hard pixel widths for the ‘p1’ so that it can be flexible for viewport widths. I just want p1 box to always be half the size of p2, regardless of inner content. Can someone help me out or suggest a better method??

<!DOCTYPE HTML>
<html>
<head>
<style type="text/css"> 
div
{
display:-moz-box; /* Firefox */
display:-webkit-box; /* Safari and Chrome */
display:box;
width:100%;
border:1px solid black;
}

#p1
{
-moz-box-flex:1.0; /* Firefox */
-webkit-box-flex:1.0; /* Safari and Chrome */
box-flex:1.0;
text-align:right;
border:1px solid red;
}

#p2
{
-moz-box-flex:2.0; /* Firefox */
-webkit-box-flex:2.0; /* Safari and Chrome */
box-flex:2.0;
text-align:left;
border:1px solid blue;
}
</style>
</head>
<body>

<div id='divA'>
<p id="p1">Hello</p>
<p id="p2">Column 2</p>
</div>

<div id='divB'>
<p id="p1">Hello</p>
<p id="p2">Why is this box larger</p>
</div>

</body>
</html>
  • 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-05-29T17:27:13+00:00Added an answer on May 29, 2026 at 5:27 pm

    If you give the children an explicit width, they will behave.
    The flex value will override these widths, giving you the desired layout. The boxes just need a value to start from. Without a defined width, they shrink to their content’s width, then the flex value is applied.

    See here: http://jsfiddle.net/ZBE7r/

    ...
    #p1, #p2 {
        width: 1px;
    }
    ...
    

    It only works if they all have the same explicit width (can be any value: 0, 1px, 100%, etc)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please tell me what I am doing wrong here? <script type=text/javascript> (document).ready(function()
can someone tell me what i am doing wrong here.. i am not getting
Can someone tell me what I am doing wrong here? I simplified it below
Please can someone tell me what im doing wrong here with respect to calling
can someone please tell what I'm doing wrong here? \newcommand{\bc}{\small\begin{verbatim}} \newcommand{\ec}{\normalsize\end{verbatim}} and then \bc
Hi can someone tell me what i'm doing wrong in this jquery statement. I
Can someone who is way smarter than I tell me what I'm doing wrong..
If someone can tell me what I'm doing wrong it'd be great. If not,
Can someone tell me the different between LinkButton.PostBackUrl and HyperLink.NavigateUrl? I've got a asp.net
Can someone tell what is wrong with this query? sqltext = SELECT utyp, count(*)

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.