Hide div table's content based upon remaining space





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have two div boxes next to each other. The left box containing a "div table". When resizing the page, I want the content of the left div table to be hidden, e.g. overflow: hidden.
However, the left box contains the "remaining" space, whereas the right box has a width of 35%.



When the content of the div table is wider than "the remaining space" (width of the left box), than the right border of the table is not visible anymore.



I would like to hide the remaining of the image, but keep seeing the right border of the div table. Can this be done using div tables?



HTML



    <div class="table" id="containerRight">Some content on the right</div>
<div id="containerLeft">
<div class="table" id="tableLeft">
<div class="table-row">
<div class="table-cell">
<div style="width:14px;"></div>
</div>
<div class="table-cell">Some title</div>
<div class="table-cell">
<div style="width:14px;"></div>
</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell">
<!-- This is the content of the LEFT table -->
<img src="http://oasis-church-nj.com/wp-content/uploads/2011/04/easter-egg.jpg" style="height:100px; width:500px;" />
</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>


CSS



.table {
display: table;
overflow: hidden;
border-collapse: collapse;
}

.table-row {
display: table-row;
}

.table-cell {
display: table-cell;
word-break: all;
overflow: hidden;
}

#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: hidden;
margin: 0px 0px 15px 0px;
}

#containerRight {
background: #FF0;
position: relative;
min-width: 220px;
max-width: 400px;
width: 35%;
height: 300px;
float: right;
margin: 0px 0px 15px 15px;
}


Example can be found here. Make the HTML table wider and smaller, the right border will dissapear.
http://jsfiddle.net/gqmJ9/










share|improve this question

























  • Border? Do you mean the strip of magenta background color?

    – Steve Wellens
    Mar 31 '13 at 1:05











  • See the table as 9 cells, 3 rows 3 colums. The center cell is the "content" whereas the outer 8 cells are what I would define as "border". Of cause in the final code they will be filled with images to show a nice box.

    – Jeffrey
    Mar 31 '13 at 1:09


















0















I have two div boxes next to each other. The left box containing a "div table". When resizing the page, I want the content of the left div table to be hidden, e.g. overflow: hidden.
However, the left box contains the "remaining" space, whereas the right box has a width of 35%.



When the content of the div table is wider than "the remaining space" (width of the left box), than the right border of the table is not visible anymore.



I would like to hide the remaining of the image, but keep seeing the right border of the div table. Can this be done using div tables?



HTML



    <div class="table" id="containerRight">Some content on the right</div>
<div id="containerLeft">
<div class="table" id="tableLeft">
<div class="table-row">
<div class="table-cell">
<div style="width:14px;"></div>
</div>
<div class="table-cell">Some title</div>
<div class="table-cell">
<div style="width:14px;"></div>
</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell">
<!-- This is the content of the LEFT table -->
<img src="http://oasis-church-nj.com/wp-content/uploads/2011/04/easter-egg.jpg" style="height:100px; width:500px;" />
</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>


CSS



.table {
display: table;
overflow: hidden;
border-collapse: collapse;
}

.table-row {
display: table-row;
}

.table-cell {
display: table-cell;
word-break: all;
overflow: hidden;
}

#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: hidden;
margin: 0px 0px 15px 0px;
}

#containerRight {
background: #FF0;
position: relative;
min-width: 220px;
max-width: 400px;
width: 35%;
height: 300px;
float: right;
margin: 0px 0px 15px 15px;
}


Example can be found here. Make the HTML table wider and smaller, the right border will dissapear.
http://jsfiddle.net/gqmJ9/










share|improve this question

























  • Border? Do you mean the strip of magenta background color?

    – Steve Wellens
    Mar 31 '13 at 1:05











  • See the table as 9 cells, 3 rows 3 colums. The center cell is the "content" whereas the outer 8 cells are what I would define as "border". Of cause in the final code they will be filled with images to show a nice box.

    – Jeffrey
    Mar 31 '13 at 1:09














0












0








0








I have two div boxes next to each other. The left box containing a "div table". When resizing the page, I want the content of the left div table to be hidden, e.g. overflow: hidden.
However, the left box contains the "remaining" space, whereas the right box has a width of 35%.



When the content of the div table is wider than "the remaining space" (width of the left box), than the right border of the table is not visible anymore.



I would like to hide the remaining of the image, but keep seeing the right border of the div table. Can this be done using div tables?



HTML



    <div class="table" id="containerRight">Some content on the right</div>
<div id="containerLeft">
<div class="table" id="tableLeft">
<div class="table-row">
<div class="table-cell">
<div style="width:14px;"></div>
</div>
<div class="table-cell">Some title</div>
<div class="table-cell">
<div style="width:14px;"></div>
</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell">
<!-- This is the content of the LEFT table -->
<img src="http://oasis-church-nj.com/wp-content/uploads/2011/04/easter-egg.jpg" style="height:100px; width:500px;" />
</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>


CSS



.table {
display: table;
overflow: hidden;
border-collapse: collapse;
}

.table-row {
display: table-row;
}

.table-cell {
display: table-cell;
word-break: all;
overflow: hidden;
}

#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: hidden;
margin: 0px 0px 15px 0px;
}

#containerRight {
background: #FF0;
position: relative;
min-width: 220px;
max-width: 400px;
width: 35%;
height: 300px;
float: right;
margin: 0px 0px 15px 15px;
}


Example can be found here. Make the HTML table wider and smaller, the right border will dissapear.
http://jsfiddle.net/gqmJ9/










share|improve this question
















I have two div boxes next to each other. The left box containing a "div table". When resizing the page, I want the content of the left div table to be hidden, e.g. overflow: hidden.
However, the left box contains the "remaining" space, whereas the right box has a width of 35%.



When the content of the div table is wider than "the remaining space" (width of the left box), than the right border of the table is not visible anymore.



I would like to hide the remaining of the image, but keep seeing the right border of the div table. Can this be done using div tables?



HTML



    <div class="table" id="containerRight">Some content on the right</div>
<div id="containerLeft">
<div class="table" id="tableLeft">
<div class="table-row">
<div class="table-cell">
<div style="width:14px;"></div>
</div>
<div class="table-cell">Some title</div>
<div class="table-cell">
<div style="width:14px;"></div>
</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell">
<!-- This is the content of the LEFT table -->
<img src="http://oasis-church-nj.com/wp-content/uploads/2011/04/easter-egg.jpg" style="height:100px; width:500px;" />
</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>


CSS



.table {
display: table;
overflow: hidden;
border-collapse: collapse;
}

.table-row {
display: table-row;
}

.table-cell {
display: table-cell;
word-break: all;
overflow: hidden;
}

#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: hidden;
margin: 0px 0px 15px 0px;
}

#containerRight {
background: #FF0;
position: relative;
min-width: 220px;
max-width: 400px;
width: 35%;
height: 300px;
float: right;
margin: 0px 0px 15px 15px;
}


Example can be found here. Make the HTML table wider and smaller, the right border will dissapear.
http://jsfiddle.net/gqmJ9/







html css html-table






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 6:23









Brian Tompsett - 汤莱恩

4,2671339104




4,2671339104










asked Mar 31 '13 at 0:04









JeffreyJeffrey

1,3131532




1,3131532













  • Border? Do you mean the strip of magenta background color?

    – Steve Wellens
    Mar 31 '13 at 1:05











  • See the table as 9 cells, 3 rows 3 colums. The center cell is the "content" whereas the outer 8 cells are what I would define as "border". Of cause in the final code they will be filled with images to show a nice box.

    – Jeffrey
    Mar 31 '13 at 1:09



















  • Border? Do you mean the strip of magenta background color?

    – Steve Wellens
    Mar 31 '13 at 1:05











  • See the table as 9 cells, 3 rows 3 colums. The center cell is the "content" whereas the outer 8 cells are what I would define as "border". Of cause in the final code they will be filled with images to show a nice box.

    – Jeffrey
    Mar 31 '13 at 1:09

















Border? Do you mean the strip of magenta background color?

– Steve Wellens
Mar 31 '13 at 1:05





Border? Do you mean the strip of magenta background color?

– Steve Wellens
Mar 31 '13 at 1:05













See the table as 9 cells, 3 rows 3 colums. The center cell is the "content" whereas the outer 8 cells are what I would define as "border". Of cause in the final code they will be filled with images to show a nice box.

– Jeffrey
Mar 31 '13 at 1:09





See the table as 9 cells, 3 rows 3 colums. The center cell is the "content" whereas the outer 8 cells are what I would define as "border". Of cause in the final code they will be filled with images to show a nice box.

– Jeffrey
Mar 31 '13 at 1:09












1 Answer
1






active

oldest

votes


















0














May be this is what u want:



http://jsfiddle.net/Bh8hg/1/



Simply made a real border to the left div.



#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: auto;
margin: 0px 0px 15px 0px;
border: #F0F 15px solid; //real border
}


also remove <div style="width:14px;"></div>,
it's not good idea to put style in html, hard to maintain.






share|improve this answer
























  • Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

    – Jeffrey
    Mar 31 '13 at 9:22












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15724907%2fhide-div-tables-content-based-upon-remaining-space%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














May be this is what u want:



http://jsfiddle.net/Bh8hg/1/



Simply made a real border to the left div.



#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: auto;
margin: 0px 0px 15px 0px;
border: #F0F 15px solid; //real border
}


also remove <div style="width:14px;"></div>,
it's not good idea to put style in html, hard to maintain.






share|improve this answer
























  • Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

    – Jeffrey
    Mar 31 '13 at 9:22
















0














May be this is what u want:



http://jsfiddle.net/Bh8hg/1/



Simply made a real border to the left div.



#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: auto;
margin: 0px 0px 15px 0px;
border: #F0F 15px solid; //real border
}


also remove <div style="width:14px;"></div>,
it's not good idea to put style in html, hard to maintain.






share|improve this answer
























  • Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

    – Jeffrey
    Mar 31 '13 at 9:22














0












0








0







May be this is what u want:



http://jsfiddle.net/Bh8hg/1/



Simply made a real border to the left div.



#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: auto;
margin: 0px 0px 15px 0px;
border: #F0F 15px solid; //real border
}


also remove <div style="width:14px;"></div>,
it's not good idea to put style in html, hard to maintain.






share|improve this answer













May be this is what u want:



http://jsfiddle.net/Bh8hg/1/



Simply made a real border to the left div.



#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: auto;
margin: 0px 0px 15px 0px;
border: #F0F 15px solid; //real border
}


also remove <div style="width:14px;"></div>,
it's not good idea to put style in html, hard to maintain.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 31 '13 at 2:34









ShoSho

17017




17017













  • Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

    – Jeffrey
    Mar 31 '13 at 9:22



















  • Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

    – Jeffrey
    Mar 31 '13 at 9:22

















Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

– Jeffrey
Mar 31 '13 at 9:22





Almost, I now also want to fill the boarder with a background image. The <div style="width:14px;"></div> was added to show that there actually was something on the left and right of the image :)

– Jeffrey
Mar 31 '13 at 9:22




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15724907%2fhide-div-tables-content-based-upon-remaining-space%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings