Text in popup Div disappears on mobile - html

I have a webpage of vocabulary words, and hovering over the words triggers a popup with the definition. I accomplish this with the "dropdown" and "dropdown" content Divs. However for some reason the content inside the Divs (in this case the vocab words themselves) completely disappear in mobile, although the unordered list bullets do not. This is a pure html/css settup so I'm not sure what the issue is. I've already tested it on multiple browsers and phones and the problem is clearly displaying on mobile, whether it's iOS or Android.
Here is how the HTML looks like for one of the vocab words:
<ul><li style="color:white; float:left; width:50%;" rel="color:white;float:left; width:50%;"><div class="dropdown"><strong><span style="font-size: 16px; color:white;">Character</span></strong><div class="dropdown-content"><span style="color: rgb(0, 0, 0);">The nature of an individual's moral personality, derived from his rooted, chosen moral values which are
consistently applied and expressed by his behavior and actions.</span></div>
Here's the dropdown code from the stylesheet:
.dropdown {
position: absolute;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
width: 300%;
min-width:350px;
max-width:850px;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
Note I am working off a third party online courses platform for what it's worth. There may be some styling rules hidden that could cause issues, but hopefully whatever is causing this is obvious enough to much more seasoned developers.

.dropdown {
position: absolute;
display:block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
width: 300%;
min-width:350px;
max-width:850px;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
</style>
<ul>
<li style="color:white; float:left; width:50%;" rel="color:white;float:left; width:50%;">
</li>
</ul>
<div class="dropdown">
<strong>
<span style="font-size: 16px; color:black;">Character
</span>
</strong>
<div class="dropdown-content">
<span style="color: rgb(0, 0, 0);">The nature of an individual's moral personality, derived from his rooted, chosen moral values which are
consistently applied and expressed by his behavior and actions.
</span>
</div>
</div>
hi i tried your html and its working hope this helps thanks

Related

Rendering Problem in BOTH Chrome & Firefox with CSS Transform

Although sometimes a pixel here or there must be forgiven and forgotten.
But in this example this simple menu's need to be rendered pixel-perfectly!
That is to say, the gaps between the menu items must be exactly equal.
In my example all menu separators looks ugly and fuzzy and disoriented as some items melt together.
While others are too far apart. Its a mess. After a nights sleeping,
I have come to the conclusion that this is one of those scenario's where the life's motto
of accepting whatever comes at you cannot be accepted and a designer must take a stand.
Whether its a dashed or solid line, the problem occurs in each and every whay I approach it.
setting margins to -1px and adding a border of 1px does not fix this.
Both examples are made from the newest version of Chrome and Firefox in 2022.
Is there a way we can separate the items with an equal, exact pixelated/aliased sharp line, without the vague anti-aliased fuzzy line of seemingly random thickness to happen?
You are allowed to rewrite it entirely or use flexbox or any other elegant CSS solution!
..............................
nav ul{
list-style: none;
margin: 0;
padding: 0;
}
nav {
top: 0px;
left: 0px;
position: absolute;
height: auto;
display: inline-block;
font-style: italic;
font-size: 1.25em;
padding: 0px 0 0 0;
}
nav li {
background-color: blue;
writing-mode: vertical-rl;
transform: scale(-1);
line-height: 1em;
border-top: 1px dashed white;
}
nav li a {
display:block;
text-decoration: none;
color: #fff;
padding: 2em;
}
<nav>
<ul>
<li>Bureau</li>
<li>Projecten</li>
<li>Diensten</li>
<li>Ontwerpen</li>
<li>Concepten</li>
<li>Kunsten</li>
</ul>
</nav>
Borders can be fiddly when you start applying transforms to the element they are applied to, so remove the transform:scale(-1) from the containing <li> elements and transform the <a> instead:
nav li {
background-color: blue;
writing-mode: vertical-rl;
line-height: 1em;
border-top: 1px dashed white;
}
nav li a {
display:block;
text-decoration: none;
color: #fff;
padding: 2em;
transform:rotate(180deg); <- other transforms are available :)
}
Snippet here based on your code: https://codepen.io/29b6/pen/KKQZywz

<div> gets moved out of an a-element

I have a problem. I suspect that the problem is a browser-side rendering problem. Maybe even an expectable behaviour, but I have no idea, and that is why I am going to ask you:
I have an <a>-element and I place two other elements (a <span> and a <div>, the <div> has even more children) inside that element.
I upload my HTML-file to my server and can access and download it (e.g. via curl or wget). There is no problem and the file is exactly the same. When I open it in web browsers (I tested Firefox and Chrome) it is still the same, but only when I open it using the "debugging" tab where I can see the original files. The displayed HTML-file (which I can access using the "inspection" tab) is different. The <div>-element got moved out of the <a>-element. Here is the code-snippet:
<div class="navbar">
A link
<a class="dropdown">
<span>A dropdown</span>
<div class="dropdown-content">
Another link
And a third link
</div>
</a>
</div>
As you can guess, it is a snipped from a navbar ;) Maybe you need the CSS (I use SCSS-files) too:
.navbar {
background-color: $navbar-color;
overflow: hidden;
padding-left: 10vw;
padding-right: 10vw;
a {
position: relative;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
color: $navbar-text-color;
}
a.dropdown {
position: static;
display: inline-block;
span::after {
content: '\f0d7';
font-family: FontAwesome;
padding-left: 6px;
}
.dropdown-content {
display: block;
position: absolute;
background-color: $navbar-color;
min-width: 160px;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
a {
float: none;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
color: $navbar-text-color;
}
}
}
}
I know, the design is not perfect and not finished, but I expect I am facing an HTML problem and so I wanted to ask you first.
Do you have any hints, ideas, references, explanations or corrections for me? I would really appreciate it.

Adding a dropdown menu to my navigation bar moved that child to the right

When I tried to add a dropdown menu to my navigation bar it sent that child to the right of the navigation bar. I want it to be the 3rd child. How can I fix that? I tried to make it an absolute to keep its place however, it will then place itself over another child. I do not want that.
rightNav {
float: left;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
background: white;
}
.rightNav:hover{
color: #0067ff;
transition-duration: .4s;
}
.bar {
background-color: white;
}
.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 15px;
text-decoration: none;
display: block;
font-size: 17px;
}
.dropdown-content a:hover {
background-color: #ebebeb;
transition: .1s;
}
.dropdown:hover .dropdown-content {
display: block;
}
<div class="navbar">
<div>
LOGO
<div class="w3-right smallScreen">
HOME
DIRECTOR OF BANDS
<div class="dropdown">
MARCHING BAND
<div class="dropdown-content">
MARCHING BAND
STAFF
MUSIC
</div>
</div>
CONCERT BAND
JAZZ BAND
CLASSES
MEDIA
CONTACT US
</div>
Antonio.
I tried replicating your code to troubleshoot it, but the CSS is poorly pasted, so I won't be able to give you a full picture on it right now.
If I understand correctly, the issue you're facing is that the drop-down content isn't behaving as such, instead just showing up as links in the nav-bar. Correct?
If that is the case, I would refer you to https://www.w3schools.com/howto/howto_js_dropdown.asp as you'd need some JavaScript to make it work. There is some neat code there ready for the use. Also, I would strongly recommend that you use no spaces in any of the class names in your HTML, as it becomes quite impossible to reference them later in your CSS code.

Should I use the ARIA directory role for a breadcrumbs list?

I am trying to add accessibility to a breadcrumbs component, which is based on a <ul> element. I have been researching ARIA roles and I stumbled upon the directory role, which seems like a good fit. However, I cannot figure out if it really is a good fit or not for my breadcrumbs component and if my component implements whatever is required based on the role's description. A demo of my breadcrumbs list styling and structure is provided below:
ul.breadcrumbs {
display: -webkit-box;
display: -webkit-flex;
display: flex;
list-style: none;
margin: 10px 8px;
padding: 0;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.15);
}
ul.breadcrumbs li {
-webkit-box-flex: 1;
max-width: 100%;
-webkit-flex-grow: 1;
flex-grow: 1;
-webkit-flex-basis: 0;
flex-basis: 0;
position: relative;
text-align: center;
background: #e0e0e0;
height: 32px;
line-height: 32px;
margin-right: 18px;
}
ul.breadcrumbs li:before,
ul.breadcrumbs li:after {
content: "";
position: absolute;
top: 0;
width: 0;
height: 0;
border: 0 solid #e0e0e0;
border-width: 16px 8px;
}
ul.breadcrumbs li:before {
left: -16px;
border-left-color: transparent;
}
ul.breadcrumbs li:after {
left: 100%;
border-color: transparent;
border-left-color: #e0e0e0;
}
ul.breadcrumbs li:first-child:before {
border: 0;
}
ul.breadcrumbs li:last-child {
margin-right: 0;
}
ul.breadcrumbs li:last-child:after {
border: 0;
}
<ul class="breadcrumbs">
<li>Root
</li>
<li>Folder
</li>
<li>File</li>
</ul>
The breacrumbs microformat uses the role navigation, which seems more appropriate :
http://microformats.org/wiki/breadcrumbs-formats
Read also, the following question: Proper ARIA handling of breadcrumb navigation
Short answer: No. You should use the navigation role instead.
Long answer
If you use the <nav> HTML5 element, the navigation role is automatically inferred.
<nav></nav>
<!-- is equivalent to -->
<div role="navigation"></div>
A fully accessible breadcrumb component can be implemented as follows:
<nav aria-label="breadcrumbs">
<ol>
<li>
<a href="/">
Home
</a>
<span aria-hidden="true">→<span>
</li>
<li>
<a href="/parent">
Parent
</a>
<span aria-hidden="true">→<span>
</li>
<li>
<a
href="/parent/current"
aria-current="location"
>
Current
</a>
</li>
</ol>
</nav>
Some notes:
Use <nav> to automatically use the navigation landmark (your question).
Use aria-label to provide a meaningful name to the <nav> (most likely, you have more <nav> elements on the page and you should label each one accordingly)
Use <ol> to make the set of links structured as a hierarchy. This also helps screen reader users understand how "nested" your page is as it will be announce as "breadcrumbs, navigation (next) list, 3 items"
Use aria-current="location" or aria-current="page" on the last page of the list to mark it as the current page.
(optional) if the breadcrumbs separator is implemented in HTML, make sure to hide it from screen reader users with aria-hidden="true".

removing strange clickboxes on image-link

I'm using bootstrap to make some buttons containing images.
But when I click them, a strange horizontal line appears, as well as a dotted bounding box on FF.
i have tried outline: none;,but it doesn't change anything...
how can i re-arrange the html (or edit the css) to fix this? I don't want those boxes (especially the horizontal one in the middle)
thanks
html
<div class="button frontbutton col-md-4">
<a href="/tips">
<img src="url.png" class="buttonPic">
<span data-i18n="buttons.tips">Tips</span>
</a>
</div>
css
.frontbutton {
padding: 15px;
}
.button {
display: inline-block;
color: #444;
border: 1px solid #CCC;
background: rgba(210, 210, 210, 0.62);
box-shadow: 0 0 5px -1px rgba(0,0,0,0.2);
margin: 0px;
cursor: pointer;
vertical-align: middle;
text-align: center;
}
a {
color: #199ACE;
outline: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
img.buttonPic {
width: 95%;
}
thanks
https://jsfiddle.net/pLkyqz0x/
UPDATE
while making the fiddle, i noticed what caused the gray bar (box shadow on a:active)
but the red box on FF remains....
This is the a:focus { } style. So you can remove it by setting a:focus { outline: none; } however this is not considered best practice as the focus style is an accessibility requirement. You should instead redefine focus styles that work for you. (For further reading on why this is bad practice: http://www.outlinenone.com/)