This is my first "phonegap" application project, so done with the listview in html based on the requirement but listview is not properly formatted (ie one below the other), how to make the items to display one below the other. please help me.
here's my code for listview
<div>
<ul data-role="listview" data-inset="true">
<li><a href="#">
<img src="images/c3.jpeg" align="left">
<h3>CONGRATULATIONS</h3>
</a>
</li>
<li><a href="#">
<img src="images/c2.jpeg" align="left">
<h3>HOLYDAY</h3>
</a>
</li>
<li><a href="#">
<img src="images/card1.jpeg" align="left">
<h3> I'M SORRY </h3>
</a>
</li>
<li><a href="#">
<img src="images/c4.jpg" align="left">
<h3> HAPPY BIRTHDAY </h3>
</a>
</li>
<li><a href="#">
<img src="images/c5.jpg" align="left">
<h3> MISSING U</h3>
</a>
</li>
<li><a href="#">
<img src="images/images.jpg" align="left">
<h3> ENGAGEMENT</h3>
</a>
</li>
![device output][1]
First of all you cannot use <br /> as direct ul child and secondly am sure you are using float: left; for the images which are inside li tag and thus it is spoiling the layout. Inorder to fix it, use the CSS property block below
ul.class_name li {
overflow: hidden;
/* Other styles goes here */
}
Just assign a class to ul element, replace the .class_name in CSS with the class you assigned to the ul element in your HTML.
Also, you can use the below declaration to self clear the parent element like
.clear:after {
display: table;
content: "";
clear: both;
}
This will self clear the parent element just like overflow: hidden; does, but in a better way.
Related
Here is the HTML and then the CSS. As you can see the aside is covering all the li items. The CSS is using the aside tag to add the border around all of these elements, but it is only adding a border around the first li item. I have tried adding a separate aside element around each li to overcome this but this didn't work. I have inspected using chrome dev tools and couldn't understand why this is happening.
<aside>[enter image description here][1]
<h5><strong>Related posts</strong></h5>
<ul>
<li class="related-post">
<img
src="img/mantyping.jpg"
alt="mantyping"
width="100"
height="70"
/>
<div>
<a href="Howtolearnwebdevelopment.html" class="related-link"
>How to learn web development</a
>
<p class="related-author"><strong>By Jonas Schmed</strong></p>
</li>
</div>
<li class="related-post">
<img
src="img/csspower.jpg"
alt="lightning"
width="100"
height="70"
/>
<div>
<a href="Unknownpowersofcss.html" class="related-link"
>The unknown powers of css</a
>
<p class="related-author"><strong>By Jim Dillon</strong></p>
</li>
</div>
<li class="related-post">
<img
src="img/javascriptcode.png"
alt="javascript code"
width="100"
height="70"
/>
<div>
<a href="javascriptisawesome.html" class="related-link"
>Why Javascript is awesome</a
>
<p class="related-author"><strong>By Matilda</strong></p>
</li>
</div>
</ul>
</aside>
aside {
background-color: #f7f7f7;
border-top: 5px solid #1098ad;
border-bottom: 5px solid #1098ad;
padding: 50px;
width: 500px;
}````
[1]: https://i.stack.imgur.com/1hIls.png
I am not sure if you are looking forward to adding a border to all list items or want to add a border to the entire aside. In this solution, I'm showing how you can add borders to each list of items. If you want to add a border to the entire <aside>, just replace the .related-post class with aside. Be careful about the code formatting with correct opening and closing tags, else it may break the UI.
/* aside { */
.related-post {
background-color: #f7f7f7;
border: 5px solid #1098ad;
padding: 50px;
width: 500px;
list-style-type: none; /* It removes the bullet */
}
<aside>
<h5>
<strong>Related posts</strong>
</h5>
<ul>
<li class="related-post">
<img src="https://image.shutterstock.com/image-photo/smiling-young-man-sit-table-600w-1939452445.jpg" alt="mantyping" width="100" height="70" />
<div>
How to learn web development
<p class="related-author">
<strong>By Jonas Schmed</strong>
</p>
</div>
</li>
<li class="related-post">
<img src="https://image.shutterstock.com/image-vector/vector-illustration-abstract-electric-lightning-600w-1706216764.jpg" alt="lightning" width="100" height="70" />
<div>
The unknown powers of css
<p class="related-author">
<strong>By Jim Dillon</strong>
</p>
</div>
</li>
<li class="related-post">
<img src="https://image.shutterstock.com/image-photo/digital-technology-software-development-concept-600w-2111828198.jpg" alt="javascript code" width="100" height="70" />
<div>
Why Javascript is awesome
<p class="related-author">
<strong>By Matilda</strong>
</p>
</div>
</li>
</ul>
</aside>
Hope it helps.
I am trying to make my list horizontally and I saw that I need to type: display:inline; inside style argument but when I tried it, it didn't work. I will attach my code here maybe I did something wrong. thanks for the helpers!
<body style="font-family:Calibri; font-size:20px">
<center>
<img src="Images/Logo.jpg" style ="margin-top:100px; border:5px solid black;" alt="GameReview" title="Game Review"/>
<br />
<br />
<ul style="list-style-type:none; display:inline;">
<li>
Details
</li>
<li>
On me
</li>
<li>
Gallery
</li>
<li>
Links
</li>
<li>
Conatact me
</li>
</ul>
</center>
</body>
this is for a school project.
The inline style needs to be on the li element.
<style>
ul li {
display: inline;
}
</style>
I just started practicing HTML and some CSS,
while working on a task from the course i'm taking online I have encountered an issue with closing a div
I have created a .section3 on css
font-family: 'Handlee', cursive;
font-size: 13pt;
background-color: #fff;
padding: 15px;
margin-bottom: 10px;
border-radius: 10px;
and on the <body> i've created a span with a ul which has inside text and images along with an a href and the result looks as desired.
however, while trying to close the div I get the following error ```End tag (form) seen too early. Expected other end tag.
the code is as follows;
<div class="section2">
<h4><span>COMPLETED COURSES</span></h4>
<ul>
<li>
HTML on <strong>SoloLearn</strong> - <small>link to certificate</small>
</li>
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/" add target="_blank">
<img src="https://www.sololearn.com/Certificate/HTML/jpg/" width="100px" height="65px" alt="">
</a>
<li>
SQL on <strong>SoloLearn and Pluralsight</strong> - <a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/">
<small>link to certificate</small></a>
</li>
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/" add target="_blank">
<img src="https://www.sololearn.com/Certificate/HTML/jpg/" width="100px" height="65px" alt=""></a>
<!--error line--> </div>
I tried everything I could, please advice.
Thank you.
You did not close your <ul> tag. You should insert </ul> tag just before your </div>.
<div class="section2">
<h4><span>COMPLETED COURSES</span></h4>
<ul>
<li>
HTML on <strong>SoloLearn</strong> -
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/">
<small>link to certificate</small></a
>
</li>
<a
href="https://www.sololearn.com/Certificate/1014-6538353/pdf/"
add
target="_blank"
>
<img
src="https://www.sololearn.com/Certificate/HTML/jpg/"
width="100px"
height="65px"
alt=""
/>
</a>
<li>
SQL on <strong>SoloLearn and Pluralsight</strong> -
<a href="https://www.sololearn.com/Certificate/1014-6538353/pdf/">
<small>link to certificate</small></a
>
</li>
<a
href="https://www.sololearn.com/Certificate/1014-6538353/pdf/"
add
target="_blank"
>
<img
src="https://www.sololearn.com/Certificate/HTML/jpg/"
width="100px"
height="65px"
alt=""
/></a>
</ul>
<!--error line-->
</div>
First of all, inside a <ul> there can only be multiple <li> elements.
In your code your <a> elements are siblings to your <li>, try putting them inside.
Then you forgot to close your <ul> tag !
My advice for you is to keep your code indented, noticing missing tags will become easier.
I'm working on a project that has 2 different CSS, one light and one dark. And a few images are inside the <img> tag, and I need to change their colors, only using css, since I'M NOT ALLOWED TO CHANGE HTML OR JAVASCRIPT
So, I thought on using their ID to overlap them.
I actually got the image to be on the same place, however, behind the original image.
Any ideas?
The HTML
<div id="div-icones" style="width: 164px;">
<ul id="ulIcones" class="icones">
<li>
<a href="#" class="" title="Trocar para a versão simplificada" onclick="ChangeVersionHB('min');">
<img title="Trocar para a versão simplificada" id="imgChangeVersion" src="images/ico_hb_min.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Salvar Configuração" onclick="saveCfg();">
<img title="Salvar Configuração" id="imgSave" src="images/ico_sv.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Restaurar Configuração Padrão" onclick="resetCfgDefault();">
<img title="Restaurar Configuração Padrão" id="imgConfDefault" src="images/folder_image.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Bloquear funções de Layout" onclick="oSTBroker.fixLayout();">
<img title="Bloquear funções de Layout" id="imgCadeado" src="images/lock_open.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Configuração do Cliente" onclick="showCfgCli();">
<img title="Configuração do Cliente" id="imgCliCfg" src="images/ico_cg.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Teclas de Atalho" onclick="showHotkeys();">
<img title="Teclas de Atalho" id="imgHotkeys" src="images/ico_hk.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Manual" onclick="AbrePagina(ConfigHB.urlManual, 'WINmn', '', 'no', 'yes', '780', '560', false);">
<img title="Manual" id="imgAjuda" src="images/ico_aj.png" width="16" height="16">
</a>
</li>
<li>
<a href="#" class="" title="Seleciona CSS" onclick="AbrePagina('LstEstilos.aspx', 'LstEstilos', '', 'no', 'yes', '780', '300', false);">
<img title="Selecione o layout" id="imgSelCss" src="images/ico_ml.png" width="16" height="16">
</a>
</li>
</ul>
My CSS to change the image
#imgChangeVersion {
box-sizing: border-box;
background: url(images/ico_hb_minc.png);
background-size: 16px;
}
Since you cannot have pseudo elements with <img> tag (although it might work in some browsers, but it's certainly non-standard). So you'll have to use parent selectors if they have unique classes, ids or attributes.
In your example, all the <a> have different title values. So you can do:
a[title="Trocar para a versão simplificada"] {...}
a[title="Trocar para a versão simplificada"] img {...}
a[title="Salvar Configuração"] {...}
a[title="Salvar Configuração"] img {...}
You can hide the img by applying display:none (collapse) or visibility:hidden (keep space).
Then apply background image on each a tag, you probably also want to set it to display:block or inline-block and give it some width and height.
Try using the "content" property, like so:
#imgChangeVersion {
box-sizing: border-box;
content:url(images/image.png); /* change image here */
background-size: 16px;
}
JSFiddle
Sounds like you should use the solution that was described in some of the comments on the initial question along with css selectors like nth-of-type() or nth-child() since your <a> tags don't have classes.
img {
display: none;
}
a:nth-of-type(){
background-image: url('');
width: 16px;
height: 16px;
}
Read up on the nth-of-type selector and nth-child selector
Also consider using + selector to target <a> elements immediately within <li> elements such as:
li + a:nth-of-type(){
background-image: url('');
width: 16px;
height: 16px;
}
In both of these solutions make sure to put a number inbetween the parentheses following nth-of-type, i.e. nth-of-type(3) to target the 3rd element.
my question is, is it possioble to the link the < li > tags in widgets?
example: normaly the < a > tag is inside the < li > tag:
<div class="widget_archive">
<h3 class="footer-widget-title">Archive</h3>
<ul>
<li>Oktober 2013 (7)</li>
</ul>
</div>
but i want like this:
<div class="widget_archive">
<h3 class="footer-widget-title">Archive</h3>
<ul>
<li>Oktober 2013 (7)</li>
</ul>
</div>
i want that the user can click on the complete element, and not only on the link text.
Yes. It's possible. It's rendered well in browser's, but is not valid W3C html.
You will get an error like
Element a not allowed as child of element ul in this context.
if you try to validate in w3C
You can do your validation test through W3C HERE, you can choose also doctype for validation
<div>
<ul>
<li>
<a href="#">
Link 1
</a>
</li>
<li>
<a href="#">
Link 2
</a>
</li>
</ul>
</div>
li {
display: inline;
}
a {
display: block;
background: yellow;
width: 200px;
height: 30px;
}