JS Fiddle is here.
I found the CSS and HTML for a bracket generator. The problem is that when you zoom out the lines break. I've tried to convert the widths from specific sizes (e.g. 149px) to percentages (e.g. 15%) but to no avail.
Any idea?
CSS
.tournament4-wrap, .tournament8-wrap, .tournament16-wrap, .tournament32-wrap {
text-align: center;
}
/****** round 1 ******/
.round1-top, .round1-bottom {
float: left;
width: 150px;
height: 2em;
}
.round1-top {
line-height: 2.5em;
}
.round2-topwrap .round1-bottom {
width: 149px;
border-top: 1px solid #000;
border-right: 1px solid #000;
}
.round2-bottomwrap .round1-top {
width: 149px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
}
/****** round 2 ******/
.round2-top, .round2-bottom {
float: right;
width: 150px;
height: 4em;
}
.round2-top {
line-height: 6.5em;
}
.round3-topwrap .round2-bottom {
width: 149px;
border-top: 1px solid #000;
border-right: 1px solid #000;
}
.round3-bottomwrap .round2-top {
width: 149px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
}
.tournament4-wrap .round2-top {
border-bottom: 1px solid #000;
}
.round2-topwrap, .round2-bottomwrap {
float: left;
width: 300px;
height: 4em;
}
/****** round 3 ******/
.round3-top, .round3-bottom {
float: right;
width: 150px;
height: 8em;
}
.round3-top {
line-height: 14.5em;
}
.round4-topwrap .round3-bottom {
width: 149px;
border-top: 1px solid #000;
border-right: 1px solid #000;
}
.round4-bottomwrap .round3-top {
width: 149px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
}
.tournament8-wrap .round3-top {
border-bottom: 1px solid #000;
}
.round3-topwrap, .round3-bottomwrap, .tournament4-wrap {
float: left;
width: 450px;
height: 8em;
}
/****** round 4 ******/
.round4-top, .round4-bottom {
float: right;
width: 150px;
height: 16em;
}
.round4-top {
line-height: 30.5em;
}
.round5-topwrap .round4-bottom {
width: 149px;
border-top: 1px solid #000;
border-right: 1px solid #000;
}
.round5-bottomwrap .round4-top {
width: 149px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
}
.round4-topwrap, .round4-bottomwrap, .tournament8-wrap {
float: left;
width: 600px;
}
.tournament16-wrap .round4-top {
border-bottom: 1px solid #000;
}
/****** round 5 ******/
.round5-top, .round5-bottom {
float: right;
width: 150px;
height: 32em;
}
.round5-top {
line-height: 62.5em;
}
.tournament32-wrap .round5-top {
border-bottom: 1px solid #000;
}
.round5-topwrap, .round5-bottomwrap, .tournament16-wrap {
float: left;
width: 750px;
}
/****** round 6 ******/
.round6-top, .round6-bottom {
float: right;
width: 150px;
height: 32em;
}
.tournament32-wrap {
float: left;
width: 900px;
}
/****** styles for the winner column ******/
.winner3, .winner4, .winner5, .winner6 {
font-weight: bold;
font-style: italic;
}
.winner3 {
line-height: 8em;
}
.winner4 {
line-height: 16em;
}
.winner5 {
line-height: 32em;
}
.winner6 {
line-height: 64em;
}
HTML
<title>8 Player Tournament</title>
<div class="tournament8-wrap">
<div class="round4-top winner4">Winner</div>
<div class="round3-topwrap">
<div class="round3-top">Top finalist</div>
<div class="round2-topwrap">
<div class="round2-top">1-8 winner</div>
<div class="round1-top">#1 seed</div>
<div class="round1-bottom">#8 seed</div>
</div>
<div class="round2-bottomwrap">
<div class="round2-bottom">4-5 winner</div>
<div class="round1-top">#4 seed</div>
<div class="round1-bottom">#5 seed</div>
</div>
</div>
<div class="round3-bottomwrap">
<div class="round3-bottom">Bottom finalist</div>
<div class="round2-topwrap">
<div class="round2-top">2-7 winner</div>
<div class="round1-top">#2 seed</div>
<div class="round1-bottom">#7 seed</div>
</div>
<div class="round2-bottomwrap">
<div class="round2-bottom">3-6 winner</div>
<div class="round1-top">#3 seed</div>
<div class="round1-bottom">#6 seed</div>
</div>
</div>
</div>
UPDATED ANSWER
The problem is with the 149px widths. When you scale down, this is leading to a rounding error that is forcing items to wrap unexpectedly. It looks like this was done to account for the 1px border. Instead if you set the box model to border-box you don't need to worry about this -- the item's width includes its border size if any.
First set this:
.tournament8-wrap * {
box-sizing:border-box;
-ms-box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
Then, set all of the items that are currently sized to width: 149px to 150px
Updated fiddle:
http://jsfiddle.net/11nLfa4g/6/
Related
I've been looking everywhere and couldn't find this exact example:
I managed to do this, but as you can see, it's not inverted and not curved:
.outer {
overflow: hidden;
}
.inner {
border-bottom: 1px solid #888;
}
.inner i {
width: 40px;
height: 40px;
border: 1px solid #888;
border-radius: 150%;
background-color: #fff;
}
.inner .top {
margin-top: -20px;
}
.inner .bottom {
margin-top: -20px;
margin-bottom: -22px;
}
.inner .left {
float: left;
margin-left: -20px;
}
.inner .right {
float: right;
margin-right: -20px;
}
.content {
min-height: 10px;
}
<div class="outer">
<div class="inner">
<div class="content"></div>
<i class="bottom right"></i>
<i class="bottom left"></i>
</div>
</div>
Is that possible? I want it to as short as possible (height), like the image - and also I don't want to use an image or SVG (I tried that and it looks weird) I want to use this with dynamic width.
You need to make use of border-top instead of border-bottom
.border-curve {
width: 20em;
height: 10em;
background: transparent;
border-top: 1px solid hsl(180deg 100% 52%);
border-radius: 0.35em;
}
body {
background: gray;
}
<div class="border-curve"></div>
I would like div#alpha1 and div#alpha2 inside the div#alpha placed side by side.
CODE
#alpha {
position: relative;
padding-top: 4px;
margin-top: 8px;
margin-left: 2%;
margin-right: 2%;
width: 96%;
height: 100px;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
}
#alpha1 {
position: relative;
width: 94px;
height: 94px;
border: 1px solid black;
margin-left: 2%;
}
#alpha2 {
position: relative;
margin-top: 0px;
height: 40px;
border-top: 1px;
border-bottom: 1px solid black;
margin-left: 94px;
}
<DIV id="alpha">
<DIV id="alpha1">
<IMG src="img/jenny.jpg" width="94px" height="94px">
</DIV>
<DIV id="alpha2">
<H1 id="patientname">Jenny Thomas</H1>
</DIV>
</DIV>
you can use flexbox for that by using display:flex in parent and then flex:1 in #alpha2 to make it grow according to screen size
Don't use HTML width/height tags, instead use CSS for styling it.
Note I did a few tweaks to your code.
#alpha {
padding-top: 4px;
margin: 8px 2% 0;
width: 96%;
height: 100px;
border: solid black;
border-width: 1px 0;
display: flex
}
#alpha1 {
width: 94px;
height: 94px;
border: 1px solid black;
margin: 0 2%;
}
#alpha2 {
flex: 1
}
#alpha2 h1 {
border-bottom: 1px solid black;
height: 40px
}
<div id="alpha">
<div id="alpha1">
<img src="//lorempixel.com/94/94" />
</div>
<div id="alpha2">
<h1 id="patientname">Jenny Thomas</h1>
</div>
</div>
The easiest/fastest solution is to assign display: flex to the container #alpha
http://codepen.io/anon/pen/mPgaJP
(I also erased some unneccesary settings in there)
You just needed to set the float property of your div. Here you are :-
#alpha{
position:relative;
padding-top:4px;
margin-top:8px;
margin-left:2%;
margin-right:2%;
width:96%;
height:100px;
border-top:1px solid black;
border-bottom:1px solid black;
float: none;
}
#alpha1{
position:relative;
width:94px;
height:94px;
border:1px solid black;
margin-left:2%;
margin-right: 0px;
float: left;
}
#alpha2{
position:relative;
margin-top:0px;
height:40px;
border-top:1px;
border-bottom:1px solid black;
margin-left:9%;
float: next;
}
<DIV id="alpha">
<DIV id="alpha1">
<IMG src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTvU-f_zys67Kv6hdqJcmSN5n_dfe2igiq9lLZYpcXAyVXEBNQ6" width="94" height="94" alt="IMAGE">
</DIV>
<DIV id="alpha2">
<H1 id="patientname">Jenny Thomas</H1>
</DIV>
</DIV>
I edited your margin in alpha2 for correct display of bottom line. It is displayed correct in browser. Here it is not. You can check it here. Mark the problem solved if it helps.
Look at the next image. I drew three rectangules (black, red and yellow) and each one receives different widths:
First column: 33%
Segund column: Remaining width (?)
Third column: 15px;
All of them are float. My first try was putting the first two columns, but was not a big deal (putting 66% in the second), but when I introduced the third column, I got trouble. I´m not sure what approach could I use to deal with these widths.
This is the DOM I have created:
<article class="cart-item">
<div class="left">
<img src="images/item1.jpg"></img>
</div>
<div class="center">
<h4 class="title">Dexter Men's Max Bowling Shoes (Right Handed Only)</h4>
<span class="description">Shipping 3-day with UPS</span>
<span class="description">Color: Gray</span>
<span class="description">Size: 28.5</span>
<span class="price">$60.00</span>
</div>
<div class="right">
</div>
</article>
Some of the CSS I have:
.left {
float: left;
width: 33.33%;
padding-left: 15px;
}
.center{
float: left;
width: ?;
padding-left: 15px;
padding-right: 15px;
}
.right {
float: left;
width: 15px;
background-color: #CCCCCC;;
}
First column: 33% Second column: Remaining width (?) Third column:
15px;
All of them are float.
If you are stuck up with float and cannot change the markup, then a simple calc would serve your purpose. But, that will introduce other problems. You will need to specify the height of the container, otherwise getting the images to align will become a nightmare for you. Especially the last one.
It will look something like this:
.cart-item {
width: 320px; height: 120px; overflow: hidden;
border: 1px solid #ccc;
}
.cart-item > div { float: left; height: 100%; }
.cart-item .left { width: 33%; border: 1px solid #333; }
.cart-item .right { width: 15px; border: 1px solid #ee3; }
.cart-item .center {
width: calc(100% - 33% - 15px);
border: 1px solid #e66;
}
Demo Fiddle 1: http://jsfiddle.net/abhitalks/3sz149f0/
Demo Snippet 1:
.cart-item, .cart-item * { box-sizing: border-box; }
.cart-item {
width: 320px; height: 120px; overflow: hidden;
border: 1px solid #ccc;
}
.cart-item > div { float: left; height: 100%; }
.cart-item .left { width: 33%; border: 1px solid #333; }
.cart-item .right { width: 15px; border: 1px solid #ee3; }
.cart-item .center {
width: calc(100% - 33% - 15px);
border: 1px solid #e66;
}
<article class="cart-item">
<div class="left">
<img src="//placehold.it/64x64/66c"></img>
</div>
<div class="center">
<h4 class="title">Dexter Men's Max Bowling Shoes (Right Handed Only)</h4>
<span class="description">Shipping 3-day with UPS</span>
<span class="description">Color: Gray</span>
<span class="description">Size: 28.5</span>
<span class="price">$60.00</span>
</div>
<div class="right">
</div>
</article>
If you can change the markup and styles, then do not use float. Just use a table layout and then it would be super easy for you to arrange the content without relying on explicit height on the container.
It will look something like this:
.cart-item {
display: table;
width: 320px; overflow: hidden;
border: 1px solid #ccc;
}
.cart-item > div {
display: table-cell; vertical-align: middle; text-align: center;
}
.cart-item .left { width: 33%; border: 1px solid #333; }
.cart-item .right { width: 15px; border: 1px solid #ee3; }
.cart-item .center {
width: calc(100% - 33% - 15px);
border: 1px solid #e66; text-align: left;
}
Demo Fiddle 2: http://jsfiddle.net/abhitalks/d1qdyxrf/
Demo Snippet 2:
.cart-item, .cart-item * { box-sizing: border-box; }
.cart-item {
display: table;
width: 320px; overflow: hidden;
border: 1px solid #ccc;
}
.cart-item > div {
display: table-cell; vertical-align: middle; text-align: center;
}
.cart-item .left { width: 33%; border: 1px solid #333; }
.cart-item .right { width: 15px; border: 1px solid #ee3; }
.cart-item .center {
width: calc(100% - 33% - 15px);
border: 1px solid #e66; text-align: left;
}
<article class="cart-item">
<div class="left">
<img src="//placehold.it/64x64/66c"></img>
</div>
<div class="center">
<h4 class="title">Dexter Men's Max Bowling Shoes (Right Handed Only)</h4>
<span class="description">Shipping 3-day with UPS</span>
<span class="description">Color: Gray</span>
<span class="description">Size: 28.5</span>
<span class="price">$60.00</span>
</div>
<div class="right">
<img src="//placehold.it/6x32/666"></img>
</div>
</article>
Try
div.center { width: calc(66% - 45px); }
45px = 30px padding + 15px width of right column
Im currently trying to get my window in sharepoint to auto-resize when the user changes the size of their window. im using a web version of sharepoint at work. not allowed to use designer.
<style type="text/css">
#dgwrap {
HEIGHT: 1000px; BACKGROUND-IMAGE: url(PublishingImages/graybk.png); BACKGROUND-REPEAT: repeat-y; MARGIN-TOP: 75px; WIDTH: 1325px
}
.dgtopbox {
FONT-SIZE: 9pt; HEIGHT: 200px; FLOAT: left; TEXT-ALIGN: center; MARGIN-LEFT: 350px; MARGIN-TOP: 110px; WIDTH: 700px
}
#dgtopboxleft {
HEIGHT: 50px; FLOAT: left; MARGIN-LEFT: 350px; MARGIN-TOP: 25px; WIDTH: 200px
}
#dgtopboxright {
HEIGHT: 50px; FLOAT: right; MARGIN-TOP: 25px; WIDTH: 200px; MARGIN-RIGHT: 300px
}
#dgtopboxother {
FLOAT: left; MARGIN-RIGHT: 25px
}
#otherbutton {
HEIGHT: 35px; BACKGROUND-IMAGE: url(PublishingImages/otherbutton.png); BACKGROUND-REPEAT: no-repeat; MARGIN-TOP: 70px; DISPLAY: block; WIDTH: 160px
}
#clmbutton {
BORDER-TOP: #838b8b 1pt solid; HEIGHT: 40px; BORDER-RIGHT: #838b8b 1pt solid; BACKGROUND-IMAGE: url(PublishingImages/CLMbutton.png); BORDER-BOTTOM: #838b8b 1pt solid; BORDER-LEFT: #838b8b 1pt solid; DISPLAY: block
}
#clmbutton:hover {
BACKGROUND-IMAGE: url(/Operations/ProviderOperations/SpecialOps/PublishingImages/CLMbutton2.png)
}
#confbutton {
BORDER-TOP: #838b8b 1pt solid; HEIGHT: 40px; BORDER-RIGHT: #838b8b 1pt solid; BACKGROUND-IMAGE: url(/PublishingImages/CONFbutton.png); BORDER-BOTTOM: #838b8b 1pt solid; BORDER-LEFT: #838b8b 1pt solid; DISPLAY: block
}
#confbutton:hover {
BACKGROUND-IMAGE: url(/PublishingImages/CONFbutton2.png)
}
</style>
<div id="dgwrap">
<div id="dgtopboxleft"><a title="1box" id="CLMbutton" href="####.html"></a></div>
<div id="dgtopboxright"><a title="2box" id="CONFbutton" href="####.html"></a></div>
<div id="dgtopboxother"><a title="3box" id="otherbutton" href="####.html"></a></div>
<div class="dgtopbox">
<h3>Request Policy</h3>
<p style="text-align: left">1.text here.</p>
<p style="text-align: left">2.text.</p>
</div>
</div>
if you are trying to make page responsive you should put all the values in %, give max-width and max-height instead of height and width, try to remove Display:Block as much as possible
Regards
Arjun
I've the below html code.
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" style="margins">
<head>
<meta charset="utf-8" />
<style type="text/css">
.main {
width: 900px;
height: 320px;
border: 1px solid black;
position:relative;
}
.margins {
padding:10px 10px 10px 10px;
border: 1px solid black;
}
.top_H {
width: 720px;
height: 80px;
border: 1px solid black;
}
.mid {
display: inline-block;
clear: both;
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid black;
}
.mid_L {
width: 200px;
height: 120px;
float: left;
margin-right:10px;
border: 1px solid black;
}
.mid_C {
width: 200px;
height: 120px;
float: left;
border: 1px solid black;
margin-right:10px;
}
.mid_R {
width: 200px;
height: 120px;
float: left;
border: 1px solid black;
}
.bot {
display: inline-block;
clear: both;
margin-bottom: 10px;
border: 1px solid black;
}
.bot_L {
width: 450px;
height: 80px;
float:left;
border: 1px solid black;
}
.bot_R {
width: 200px;
height: 80px;
float: left;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="main">
<div class="margins">
<div class="top_H"></div>
<div class="mid">
<div class="mid_L"></div>
<div class="mid_C"></div>
<div class="mid_R"></div>
</div>
<div class="bot">
<div class="bot_L"></div>
<div class="bot_R""></div>
</div>
</div>
</div>
</body>
</html>
here i am trying to create a container div(margins) inside the main div, with the gap of 10 px on each side, but when i view it in web browser it is overlapped. please let me know where am i going wrong.
Here is the fiddle.
Thanks
Offcourse it is overlapping. in your .main class you have set a height, and it's not high enough. also, if you want to be absolutely sure that nothing goes over your div, set an overflow in the css !
make height of main div auto :
.main {
width: 900px;
height: auto;
border: 1px solid black;
position:relative;
}
DEMO : http://jsfiddle.net/V9N3u/2/
Now define your .main min-height and remove height
as like this
.main {
height: 320px; // remove this
min-height: 320px; // add this
}
try this
min-height for .main class
.main {
width: 900px;
min-height: 320px;
border: 1px solid black;
position:relative;
}
The others are right about the height.
You may also want to remove the margin-bottom of .bot to get rid of the extra spacing (unless that's on purpose):
.bot {
display: inline-block;
clear: both;
margin-bottom: 10px; //remove
border: 1px solid black;
}
And you also have one too many " in your html:
<body>
...
<div class="bot_R""></div>