Why don't these line up? I am using Bootstrap to make a tutoring website and I am trying to maximize the use of the grid system but I don't want to unecessarily write JavaScript functions to dynamically create the lists just yet... Is this an incorrect way to create two lists side by side? My previous solution had the lists one after the other but I think from a UX perspective they should both be immediately visible, but for some reason "Science" is a centimeter lower than "Mathematics" and I don't understand why.
<h2> MATHEMATICS </h2>
<div id = "math_div">
<ul style="width:10%; float:left;">
<li>K-5 Math</li>
<li>Middle School Math</li>
<li>Algebra</li>
<li>Plane Geometry</li>
<li>Algebra 2</li>
<li>Trigonometry</li>
<li>Solid & Analytical Geometry</li>
<li>Precalculus</li>
<li>Calculus</li>
<li> Advanced Specialties
<ul>
<li>Symbolic Logic</li>
<li>Finite Math</li>
<li>Linear & Matrix Algebra</li>
<li>Multivariable Calculus (Analysis)</li>
<li>Differential Equations</li>
<li>Linear Programming (Finance)</li>
</ul>
</li>
</ul>
</div>
<h2> SCIENCE </h2>
<div id = "science_div">
<ul style="width:10%; float:left;">
<li>Chemistry</li>
<li>Physics</li>
<li>General Physical Science</li>
<li> Advanced Specialties
<ul>
<li>Nuclear Physics & Chemistry</li>
<li>Radiochemistry</li>
<li>Radiation Science</li>
<li>Measurement Theory</li>
<li>Uncertainty Treatments</li>
</ul>
</li>
<li> Advanced Specialties
<ul>
<li>Symbolic Logic</li>
<li>Finite Math</li>
<li>Linear & Matrix Algebra</li>
<li>Multivariable Calculus (Analysis)</li>
<li>Differential Equations</li>
<li>Linear Programming (Finance)</li>
</ul>
</li>
</ul>
</div>
I'd say the issue is how the html is structured and the float:left that should probably be in the div instead of the ul (this is what is causing the second list to be a little bit below the other, because it is floating below the first title).
If you change the code a little, you get the expected behavior:
<div id="math_div" style="float:left;">
<h2> MATHEMATICS </h2>
<ul style="width:10%;">
<li>K-5 Math</li>
<li>Middle School Math</li>
<li>Algebra</li>
<li>Plane Geometry</li>
<li>Algebra 2</li>
<li>Trigonometry</li>
<li>Solid & Analytical Geometry</li>
<li>Precalculus</li>
<li>Calculus</li>
<li>Advanced Specialties
<ul>
<li>Symbolic Logic</li>
<li>Finite Math</li>
<li>Linear & Matrix Algebra</li>
<li>Multivariable Calculus (Analysis)</li>
<li>Differential Equations</li>
<li>Linear Programming (Finance)</li>
</ul>
</li>
</ul>
</div>
<div id="science_div" style="float:left;">
<h2> SCIENCE </h2>
<ul style="width:10%;">
<li>Chemistry</li>
<li>Physics</li>
<li>General Physical Science</li>
<li>Advanced Specialties
<ul>
<li>Nuclear Physics & Chemistry</li>
<li>Radiochemistry</li>
<li>Radiation Science</li>
<li>Measurement Theory</li>
<li>Uncertainty Treatments</li>
</ul>
</li>
<li>Advanced Specialties
<ul>
<li>Symbolic Logic</li>
<li>Finite Math</li>
<li>Linear & Matrix Algebra</li>
<li>Multivariable Calculus (Analysis)</li>
<li>Differential Equations</li>
<li>Linear Programming (Finance)</li>
</ul>
</li>
</ul>
</div>
As you can see in this Fiddle. I don't know if that works for you.
Related
I want to select P element which has 'ul' as immediate following-sibling from below sample xml.
<root>
<p>abc</p>
<br>
<p>def</p>
<br>
<p>FEATURES</p>
<ul>
<li>design</li>
<li>softness</li>
</ul>
<p>SIZING</p>
<ul>
<li>17'' x 24''</li>
<li>20'' x 32''</li>
<li>24'' x 38''</li>
</ul>
<p>CONSTRUCTION & CARE</p>
<ul>
<li>Nylon</li>
<li>Latex backing</li>
<li>Machine wash</li>
<li>Made in the USA</li>
</ul>
<p>SUSTAINABILITY FEATURES</p>
</root>
I have tried this //root/p[following-sibling::ul] xpath but didn't get desired answer.
Try this one to get output:
//p[following-sibling::*[position()=1 and self::ul]]
"//root/ul/preceding-sibling::p[1]"
I don't think this needs an explanation :), it's already understandable.
I'm working on a website at the minute for a project I am doing. I need to create a dropdown menu within a dropdown menu. It is part of a form. Basically its for damage to a car. In my drop down menu I have options for no damage and damage. When I select damage I need it to bring me to another form where I can select the part of the car and type in the damage. THen it needs to save. I may have worded this badly. If anyone can give me any help thta would be great
Here is what I have at the moment
Damage:<br>
<select id="test" name="form_select" onchange="showDiv(this)">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
<div id="hidden_div" style="display:none;"><br>
<input type='textarea' class='text' name='hidden style' value size='20' />
</div>
<script type="text/javascript">
function showDiv(select){
if(select.value==1){
document.getElementById('hidden_div').style.display = "block";
} else{
document.getElementById('hidden_div').style.display = "none";
}
}
</script><br><br>
This gives me a text box to enter the damage into. What I would really like is to be able to get another form whcih gives me further options to select from if this is possible
eg right front
rear left
You need to create 3 level of ul
<ul id="menu">
<li><span>Level 1-A</span>
<ul>
<li><span>Level 2-A-1</span>
<ul>
<li><span>Level 3-A-1</span></li>
<li><span>Level 3-A-2</span></li>
<li><span>Level 3-A-3</span></li>
</ul>
</li>
<li><span>Level 2-A-2</span></li>
<li><span>Level 2-A-3</span></li>
<li><span>Level 2-A-4</span></li>
</ul>
</li>
<li><span>Level 1-B</span></li>
<li><span>Level 1-C</span></li>
<li><span>Level 1-D</span></li>
<li><span>Level 1-E</span></li>
Here is an example of nested dropdown menu, hope it helps.
http://jsfiddle.net/Wss5A/
how to simplify template in angularjs? Here there are three different variants lie within podgruzki data objects, but depending on different objects IF loaded with different sets of properties. Is it possible to simplify both the template
<div class="suggest" ng-show="showSuggest" ng-if="$ctrl.Name == 'A'">
<ul class="height-list">
<li ng-repeat="node in $ctrl.Searched()" ng-mousedown="add(this)">
<span ng-attr-title="{{node.a}}">{{node.a}}</span>
</li>
</ul>
</div>
<div class="suggest" ng-show="showSuggest" ng-if="$ctrl.Name == 'B'">
<ul class="height-list">
<li ng-repeat="node in $ctrl.Searched() " ng-mousedown="add(this)">
<span ng-attr-title="{{node.b}}">{{node.b}}</span>
</li>
</ul>
</div>
<div class="suggest" ng-show="showSuggest" ng-if="$ctrl.Name == 'C'">
<ul class="height-list">
<li ng-repeat="node in $ctrl.Searched()" ng-mousedown="add(this)">
<span ng-attr-title="{{node.C}}">{{node.C}}</span>
</li>
</ul>
</div>
Let's say you normalize your node and name to be 1 to 1. So if your controller name is "a" or "Foo", then your node will have a property named a or Foo.
Then you will be able to reduce your template to the following:
<div class="suggest" ng-show="showSuggest">
<ul class="height-list">
<li ng-repeat="node in $ctrl.Searched()" ng-mousedown="add(this)">
<span ng-attr-title="{{node[$ctrl.Name]}}">{{node[$ctrl.Name]}}</span>
</li>
</ul>
</div>
I have two div inside container and those divs should be settled according to the width of container and there should be a proper space between them
<div id="testimonial-wrapper">
<div class="container">
<ul class="inline-section row">
<li class="signature-interior-features green-background col-sm-5 col-md-5">
<div class="signature-interior-content">
<h2>Signature Interior Features</h2>
<ul>
<li>Full-sized washer and dryer in every home</li>
<li>Walk-in closets and walk-in pantries and
vaulted ceilings available*</li>
<li>Appliance packages with multi-cycle dishwasher,
range and frost-free refrigerators</li>
<li>Large stainless steel sinks with disposal</li>
<li>Linen closets</li>
<li>Cozy wood-burning fireplace in every home</li>
<li>Spacious patios with exterior storage</li>
<li>Individual hot water heaters</li>
<li>Electric HeatM</li>
<li>Pre-wired for phone, cable and high-speed Internet access</li>
<li>Interior packages available*</li>
</ul>
</div><!--signature-interior-content-closed-->
</li>
<li class="community-elements-details sky-background col-sm-5 col-md-5">
<div class="community-elements-content">
<h2>Community Elements</h2>
<ul>
<li>Clubhouse with social room and kitchen</li>
<li>Athletic center with cardio equipment and free weights</li>
<li>Sparkling outdoor swimming pool</li>
<li>Invigorating indoor spa</li>
<li>Complimentary tanning studio</li>
<li>Sports court</li>
<li>Close proximity to the Sounder commuter train and
the Super Mall</li>
<li>Only minutes to Emerald Downs and I-5 with
easy access to Highway 167 and Highway 18</li>
<li>Professional on-site maintenance</li>
<li>Professional on-site management
*in select apartment home</li>
</ul>
</div><!--community-elements-content-closed-->
</li>
</ul>
</div><!--container-closed-->
</div><!--testimonial-wrapper-closed-->
I'm trying to create a recursive list using Thymeleaf. I'm using a simple Java object to model a node which has has two fields, a description and then an array list of child nodes. I'm using the following HTML/Thymeleaf to process the structure but it isn't recursively iterating through to the next level down.
My Java code looks as follows:
public class Node {
public String description;
public ArrayList<Node> children;
}
My Thymeleaf/HTML code is as follows:
<html>
...
<body>
<div th:fragment="fragment_node" th:remove="tag">
<ul th:if="${not #lists.isEmpty(node.children)}" >
<li th:each="child : ${node.children}"
th:text="${child.description}"
th:with="node = ${child}"
th:include="this::fragment_node">List Item</li>
</ul>
</div>
</body>
</html>
If my data structure looks as follows:
Main node 1
Child node 1
Child node 2
Main node 2
Child node 3
Child node 4
I'd expect to get:
<ul>
<li>Main Node 1</li>
<li>
<ul>
<li>Child node 1</li>
<li>Child node 2</li>
</ul>
</li>
<li>Main Node 2</li>
<li>
<ul>
<li>Child node 3</li>
<li>Child node 4</li>
</ul>
</li>
</ul>
However, I only get:
<ul>
<li>Main Node 1</li>
<li>Main Node 2</li>
</ul>
Can anyone spot why this may not be working?
The cause of the problem is
You are trying to th:text and trying to add the description to a <li> as well as you are trying to th:include the fragment inside the same tag <li>.
Your th:include is replaced by the th:text as th:text is processed with priority by default.
Direct solution to your source code
.....
<li th:each="child : ${node.children}" th:inline="text" th:with="node = ${child}">
[[${child.description}]]
<ul th:replace="this::fragment_node">List Item</ul>
</li>
.....
Even thought the above will work as you want, personally I find some design issues in your thymeleaf page.
Better solution using fragment parameters
...
<ul th:fragment="fragment_node(node)" th:unless="${#lists.isEmpty(node.children)}" >
<li th:each="child : ${node.children}" th:inline="text">
[[${child.description}]]
<ul th:replace="this::fragment_node(${child})"></ul>
</li>
</ul>
...