hide last hr within a loop using css - html

I have nested <hr> tag in my html, without using specified traversing, how can I hide the last hr using css but not js? I can skip the loop using js but I want to use pure css, not sure why :nth-of-type(1) hide all the <hr>
<div class="modal-body">
<div class="row">
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Indonesia</strong></div>
<div>
<div class="item">
<label>
<div class="item">
<label>
<span>Lazada ID</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Malaysia</strong></div>
<div>
<div class="item">
<label>
<span>Lazada MY</span></label>
</div>
<div class="item">
<label>
<span>Lelong MY</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Others</strong></div>
<div>
<div class="item">
<label>
<span>Alibaba</span></label>
</div>
</div>
<hr>
</div>
</div>
</div>
https://jsfiddle.net/g59e21ps/1/

Your solution is here...
.modal-body .row div:last-child hr {
display: none;
}

:nth[-last]-of-type is the nth last child of a given tag type in its parent element – not the nth last match in the entire document. You can find <hr>s that are children of last children with the child combinator >:
.modal-body :last-child > hr {
display: none;
}
updated fiddle

Try the following snippet.
.modal-body .row div:last-child hr {
display: none;
}
<div class="modal-body">
<div class="row">
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Indonesia</strong></div>
<div>
<div class="item">
<label>
<div class="sa-checkbox theme__blue checked" style="position: relative;">
<input type="checkbox" cursor="false" name="5a60626f1d41c80c8d3f8a85" value="on" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0; cursor: pointer;"></ins></div><span>Bukalapar</span></label>
</div>
<div class="item">
<label>
<span>Lazada ID</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Malaysia</strong></div>
<div>
<div class="item">
<label>
<span>Lazada MY</span></label>
</div>
<div class="item">
<label>
<span>Lelong MY</span></label>
</div>
</div>
<hr>
</div>
<div class="m-l-20 m-r-20">
<div><strong class="m-b-10">Others</strong></div>
<div>
<div class="item">
<label>
<span>Alibaba</span></label>
</div>
</div>
<hr>
</div>
</div>
</div>

Related

I have multiple blocks in design need to write the html code for that with the help divs

I am using this code to develop HTML code for the image below, but I am overlapping the divs, and stuck with code. I need to develop the solution with the help of divs in HTML.
<div style="width:80%; height: 80px;padding-right:110px;margin-right:40px">
<div style="width:26%; float: left;float:left">
<div class="pointer-blue-small1">Steps & User Requirements Definition</div>
</div>
<div style="width:15%; float: left;">
<div class="pointer-blue-small1">High Level Design</div>
</div>
</div>
<div style="background:rgb(93,188,210);width:500px;height:110px;color:white;line-height:1.2;padding:10px;margin: 5px;">
<div>
<div style="background:rgb(143,63,123);width:390px; height:40px;color:white;text-align:center;line-height:1.2;float:left;padding-left:50px;margin-left:100px">A1901 Integrated Planning</div>
</div>
<br />
<br />
<br />
<div>
<div class="pointer-purple-small" style="width:374px;height:40px;color:white;text-align:center;float:left;padding-left:50px;margin-left:100px;line-height:1.2;display:inline-block">A1102 Update Project Plan</div>
</div>
</div>
<div style="background:rgb(93,188,210);width:500px;height:60px;color:white;line-height:1.2;padding:10px;margin: 15px;display:inline-block;margin-left:6px">
<div style="background:rgb(143,63,123);width:390px; height:40px;color:white;text-align:center;line-height:1.2;float:left;padding-left:50px;margin-left:100px">A1919 Change Request Control & Monitor and Report Risks and Issues</div>
</div>
<div style="background:rgb(93,188,210);width:500px;height:175px; color:white;line-height:1.2;padding:10px;margin: 5px;" ;display: inline-block;margin-left:35px">
<div>
<div style="background:rgb(143,63,123);width:390px; height:40px;color:white;text-align:center;line-height:1.2;float:left;padding-left:50px;margin-left:100px">A1105 Quality Assurance </div>
</div>
<br />
<br />
<br />
<div>
<div style="background:rgb(143,63,123);width:390px;height:40px;color:white;text-align:center;float:left;padding-left:50px;margin-left:100px;line-height:1.2;display:inline-block">A1922 StackHolder Management</div>
</div>
<br />
<br />
<br />
<div>
<div class="pointer-purple-small" style="width:374px;height:40px;color:white;text-align:center;flo[![enter image description here][1]][1]at:left;padding-left:50px;margin-left:100px;line-height:1.2;display:inline-block">A1104 Update Quality Plan</div>
</div>
</div>
</div>
.left-parent div {
width: 40%;
height: 50px;
}
.row {
justify-content: space-between;
}
.left-parent {
justify-content: space-between;
}
.border {
border: 1px solid;
}
.flex {
display: flex
}
.left,
.right {
width: 50%;
margin: 10px
}
.child {
height: 50px;
margin-top: 20px;
}
<div class="row flex ">
<div class="left">
<div class="flex left-parent">
<div class="border left-parent-child">
</div>
<div class="border left-parent-child">
</div>
</div>
<div class="border child">
</div>
<div class="border child">
</div>
<div class="border child">
</div>
</div>
<div class="right border">
</div>
</div>

CSS and modifying div's width if radio button checked

JavaScript not accepted this time.
So, I have this CSS code. This code should change to width if radio button is checked. Nothing happens. How could I modify the code?
input[type="radio"]#someID-1:checked #extra { width: 4000px; }
I also have this HTML code:
<div id="kaaviotaulukko" style="white-space: nowrap; position: relative; text-align: center;">
<div style="display: inline-block">
<div style="DISPLAY:INLINE-BLOCK">
<input id="someID-1" name="nappi" type="radio">
<div class="listaus-sisalto" style="float:left;width:0">
<div id="navi3">
<div style="z-index:100;position:fixed;right:0;top:300px">
<span><label for="someID-1">1</label></span>
</div>
</div>
</div>
<div class="kierros" style="display: inline-block;width:350px">
R1
</div>
</div>
<div style="DISPLAY:INLINE-BLOCK">
<input id="someID-5" name="nappi" type="radio">
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi5"></div>
</div>
<div class="kierros" id="extra" style="display: inline-block;width:70px">
extra
</div>
</div>
<input id="someID-100" name="nappi" type="radio">
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi100"></div>
</div>
<div style="z-index:99;width:70px;position:fixed;left:0;top:100px;margin:auto;background-color:red">
<br>
</div>
<div style="z-index:99;width:70px;position:fixed;right:0;top:100px;margin:auto;background-color:red">
<br>
</div>
</div>
</div>
There is no child #extra of that input. Just remove that from the selector.
input[type="radio"]#someID-1:checked {
width: 4000px;
}
<div id="kaaviotaulukko" style="white-space: nowrap; position: relative; text-align: center;">
<div style="display: inline-block">
<!--
-->
<DIV STYLE="DISPLAY:INLINE-BLOCK"><input name="nappi" type="radio" id="someID-1" />
<div class="listaus-sisalto" style="float:left;width:0">
<div id="navi3">
<div style="z-index:100;position:fixed;right:0;top:300px"><span><label for="someID-1">1</label></span></div>
</div>
</div>
<div class="kierros" style="display: inline-block;vertical-align:top;width:350px">R1
</div>
</DIV>
<!--
-->
<DIV STYLE="DISPLAY:INLINE-BLOCK"><input name="nappi" type="radio" id="someID-5" />
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi5">
</div>
</div>
<div class="kierros" style="display: inline-block;vertical-align:top;width:70px" id="extra">extra
</div>
</DIV>
<!--
--><input name="nappi" type="radio" id="someID-100" />
<div class="listaus-sisalto" style="float:right;width:0">
<div id="navi100">
</div>
</div>
<!--
-->
<div style="z-index:99;width:70px;position:fixed;left:0;top:100px;margin:auto;background-color:red"><br />
</div>
<div style="z-index:99;width:70px;position:fixed;right:0;top:100px;margin:auto;background-color:red"><br />
</div>
</div>
</div>
The selector input[type="radio"]#someID-1:checked #extra selects an element with the id extra that is a child element of your radio button. Since radio buttons rarely have children, you'll need to change the selector to match your HTML structure.
I suggest placing the radio button inside the same parent element as #extra. That way you can use the selector input[type="radio"]#someID-1:checked ~ #extra which will target the #extra element if it is preceded by the radio button in selected state.
A simplified version of what you'd like to become.
#radiodiv {
background: red;
}
#radio:checked + #radiodiv {
width: 400px;
}
<input id="radio" type="radio" />
<div id="radiodiv">
<p>This is the div</p>
</div>

Aligned form - input fields/ buttons in middle of a background image

I'm trying to make a design html/css for a form like in this image:
https://postimg.org/image/u2rrzgz09/
Form should be in the center of background(-image), text(Text1 and Text2) should begin where the fields begins (left) and button should be displayed in center of form.
I did until now:
https://jsfiddle.net/jk17sj87/
HTML:
<div class="parent">
<div class="col1">
<div class="text">
Text1
</div>
<div class="sec11">
(image)
<input type="text"/>
</div>
<div class="sec2">
(image)
<input type="text"/>
</div>
</div>
<div class="col2">
<div class="text">
Text2
</div>
<div class="sec3">
(image)
<input type="text"/>
</div>
<div class="sec4">
(image)
<input type="text"/>
</div>
</div>
</div>
<div class="button">
<button>Button</button>
</div>
CSS:
.parent{ width: 100%; display: flex;}
.col1{margin-right: 10px;}
.text{margin-left: 52px;}
.button {margin-left: 200px;}
/*Programs*/
.parent{
width: 100%;
display: flex;
height: 100%;
min-height: 200px;
}
.col1, .col2 {
display: inline-block;
}
.text{
margin-left: 52px;
}
.button {
text-align: center;
}
.parent-content {
margin: auto;
}
<div class="parent">
<div class="parent-content">
<div class="col1">
<div class="text">
Text1
</div>
<div class="sec11">
(image)
<input type="text"/>
</div>
<div class="sec2">
(image)
<input type="text"/>
</div>
</div>
<div class="col2">
<div class="text">
Text2
</div>
<div class="sec3">
(image)
<input type="text"/>
</div>
<div class="sec4">
(image)
<input type="text"/>
</div>
</div>
<div class="button">
<button>Button</button>
</div></div></div>
.parent {
width: 100%;
display: flex;
max-width: 465px;
margin: 0 auto;
}
.button {
text-align: center;
}

irritating div with content

Here is my http://jsfiddle.net/8wSzk/2/
<div class="row1">
<div>
<div class="circle-menu">
</div>
<p> some option </p>
</div>
<div>
<div class="circle-menu">
</div>
<p> some option <br /> and <br /> another option </p>
</div>
</div>
<div class="row2">
<div>
<div class="circle-menu">
</div>
<p> circle3 </p>
</div>
<div>
<div class="circle-menu">
</div>
<p> circle4 </p>
</div>
</div>
I want my both circle to be in a straight line with its content just below the circle. can somebody help me fixing my css. I am quite new to it.
I think this is what you want. If you want to have two elements side to side, you must use the float attribute. In this case, it would be float:left;.
EDIT
NEW DEMO
Do it like this
<div class="row1">
<div>
<div class="circle-menu">
</div>
</div>
<div>
<div class="circle-menu">
</div>
</div>
</div>
<div class="row1">
<div>
<p> some option </p>
</div>
<div>
<p> some option <br /> and another option </p>
</div>
</div>
New fiddle Code:Works Perfect
Here you go mate, redone it for you. Have a look through it and see what I've done
<div class="row1">
<div class="circle-menu">
</div>
<div class="circle-menu">
</div>
</div>
<div class="options-row">
<div class="option">Some option
</div>
<div class="option">Some more options
</div>
</div>
<div class="row2">
<div class="circle-menu">
</div>
<div class="circle-menu">
</div>
</div>
<div class="options-row">
<div class="option">Even more options
</div>
<div class="option">Got the idea?
</div>
</div>
.row1 {
height:90px;
}
.row2 {
height:90px;
}
.circle-menu {
width: 80px;
height: 80px;
display: inline-block;
float:left;
background-color: #cacece;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
cursor: pointer;
margin: 5px;
}
.option {
display:inline-block;
width:80px;
margin: 5px;
text-align:center;
vertical-align:top;
}
.options-row {
}

Display, generated div's horizontally within a container with scrollbar

I am trying to display dynamic generated div's horizontally with scroll bar. There can be n number of div's.
Below is my Code:
HTML (index.html)
<div style="width:100%;float:left;" id="old">
<div>
<h1>First Div</h1>
<div id="R1">
<h1>First Div Internal</h1>
<a id="R1_index" class="close_page" href="javascript:void(0)">Close</a>
</div>
</div>
<div>
<h1>Second Div</h1>
<div id="R2">
<h1>Second Div Internal</h1>
<a id="R2_index" class="close_page" href="javascript:void(0)">Close</a>
</div>
</div>
</div>
I follow this link for solution.
But when dynamic div's load, structure looked messed up.
Here is the messy look:
HTML (index.html)
<div style="width:100%;float:left;" id="old">
<div id="items">Missing Internal Content</div>
<div id="items">Missing Internal Content</div>
</div>
Please help me guys.
i imagin the problem is that the div's in the container (id="old" in your example) are not next to each other, but instead beneath.
if that is your problem, you add the following styles to your container:
#old {
overflow: auto;
white-space: nowrap;
}
and make the childern-divs inline-block elements:
#old > div {
display: inline-block;
}
then it should work as expected. see the working solution:
* {
padding: 0;
margin:0;
}
#container {
width: 300px;
height: 100px;
overflow: auto;
white-space: nowrap;
}
.element {
display: inline-block;
}
.box {
width: 100px;
height: 100px;
background: lightgrey;
}
<div id="container">
<div class="element">
<div class="box">
<h1>1</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>2</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>3</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>4</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>5</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>6</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>7</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>8</h1>
</div>
</div>
</div>
otherwise please provide a better example/description of what the problem exactly is.