When transformed into clickable links, the list items start piling up on

Here are two groups of code along with a straightforward question that most people can answer easily, but still worth asking.

Below is the initial piece of code with working CSS implementation:

<div class="subTopHolder">
    <ul class="language">
            <li><a href="#" title="Türkçe">TR</a></li>
            <li>EN</li>
        </ul>

The issue arises when I try to turn 'EN' into a hyperlink. The resulting code looks like this:

<div class="subTopHolder">
    <ul class="language">
            <li><a href="#" title="Türkçe">TR</a></li>
            <li><a href="#" title="English">EN</a></li>
        </ul>

In this scenario, instead of appearing next to each other with a margin, they end up stacked vertically.

The accompanying CSS code is as follows:

div.subTopHolder
{
    width:1002px;
    height:201px;
    margin:auto auto;
    padding:0 12px;
    position:relative;
    overflow:hidden;
    background:url(../images/bck-bannerHolder.jpg) no-repeat center top;
}

ul.language
{
    float:right;
    clear:left;
    padding:2px 0;
    margin-bottom:4px;
    cursor:default;

}
ul.language li
{
    display:inline;
    background:#f8c180;
    padding:2px 4px;
    font-size:10px;
    cursor:default;
    text-shadow:0 1px white;
    border-radius:2px;
}
ul.language li a
{
    font-size:10px;
    display:block-inline;
    background:#fff;
    color:#000;
    text-decoration:none;
    margin:-2px -4px;
    padding:2px 4px;
    border-radius:2px;


     transition:all .5s;
    -moz-transition:all .5s;
    -webkit-transition:all .5s;
}
ul.language li a:hover
{
    box-shadow:1px 1px 8px 0px black;   

Answer №1

Here are a couple of issues that need to be addressed:

  1. First and foremost, the html syntax is incorrect. The proper format for a link should be as follows:

    <a href="#" title="English">EN</a>
    
  2. The style applied to ul.language li is incorrect. Instead of using display: inline;, it should be changed to display: inline-block;.

Answer №2

Adjust the styling for ul.language li to either display as inline-block or float left.

ul.language li
{
    // Utilize an IE hack
    display: inline;
    float: left;
    zoom: 1;
}

or

ul.language li
{
    *display: inline;
    zoom: 1;
    display: inline-block;
}

Answer №3

Here is how it should look like:

<a href="#" title="English">English</a>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with event listener arising once elements have been loaded into the dom

I have a project where I want to click on a category card to obtain its id and then redirect to the movies screen. I understand that using row.eventlistener() in index.js executes before the elements are rendered, causing the id not to be captured. How ca ...

Unable to showcase information in the center of an HTML document

Hello, I'm facing an issue with my HTML page that has a left vertical nav-bar. Despite my efforts, I can't seem to display content (text) in the center of the page as shown in the screenshot with the red oval. I've attempted inserting text ...

Differences in row padding when transitioning from Bootstrap 3 to Bootstrap 4

One thing I've noticed is that when utilizing Bootstrap 3, the use of div.row would automatically create a vertical spacing between rows which was quite appealing. However, upon transitioning to Bootstrap 4, this automatic spacing seemed to disappear. ...

Executing 'npm start' to launch an HTML file along with a CSS stylesheet - A step-by-step guide

As a newcomer to the world of coding, I've found that asking questions on platforms like Stack Overflow enables me to connect with fellow developers. I usually code using VS Code and rely on the "live server" extension to quickly test my code. Howeve ...

Clicking on a radio button can trigger the selection of another radio button

I'm currently working on a form that includes 8 radio buttons - 4 for System A and 4 for System B. The options for the buttons are CF, ISO, ISO-B, and NW. My goal is to create a functionality where selecting a radio button in System A automatically se ...

Are there any special CSS hacks that only work for IE8?

When it comes to Internet Explorer 8 (IE8), my preference is to utilize the following CSS: color : green; I am looking to implement a hack that exclusively impacts IE8, without affecting IE9, IE6, and 7. ...

The fixed navigation bar shows a flickering effect while scrolling at a slow pace

Currently facing a challenge with our sticky navigation. Noticing a flickering issue on the second navigation (sticky nav) when users scroll down slowly. The problem seems to be specific to Chrome and Edge, as it doesn't occur on Firefox, IE11, and S ...

Struggling with evenly positioning 6 elements in two rows using CSS

For positioning 6 different elements on a webpage, I've experimented with various methods: I initially tried stacking two unordered lists vertically but faced issues with scaling when stretching the page. Another attempt was using a table, but I stru ...

JavaScript Tab Fade Effect

I have a tab system that utilizes JavaScript to switch tabs. I am trying to implement a fade in and out effect when switching tabs. The current JavaScript simply adds or removes the clicked tab selected by the user. I have managed to partially achieve the ...

Error: The module you are trying to import from the package is not found. Please check the package path and make sure that

I encountered an issue when trying to compile a code in Reactjs. As a beginner in Reactjs, I'm struggling with this. Module not found: Error: Package path ./cjs/react.development is not exported from package /Users/mansi/letsgrowmore/to-do-list/my-rea ...

Trigger a series of functions upon clicking with ReactJS

Need some assistance with an alert message functionality. I have a button labeled Checkout, and when clicked, it should clear the cart and display an alert. At present, the individual functions work as expected - calling emptyCart() works fine, and calling ...

I require assistance in developing a mouseover image link that conceals the top image and unveils a bottom image that scrolls vertically in the exact same area as the top

I am trying to achieve a similar effect as shown on: this website I require assistance in creating a mouseover image link that hides the top image and reveals a bottom image that scrolls vertically within the same space as the top image. The long vertica ...

What is the process for displaying a hidden div using a button?

I'm running into a problem with my project. Here is the code I've been using to hide my div element : @keyframes hideAnimation { to { visibility: hidden; } } To trigger the animation and hide the div after 6 seconds, I have implemented ...

What is the best way to add an active class to a clicked menu item that already has a class

I have menu items on the master page, and if users click on that menu item, I want to show it as active. My goal is to append "Active" to the existing class to indicate that it is active. _Layout.cshtml: <div class="menu-items-navigation"> <di ...

Unfinished card or cut-off content within a bootstrap accordion

Greetings to the StackOverflow community! I am facing an issue with my accordion and card setup, where the card is not fully displayed within the button at the bottom. The following image illustrates the problem: https://i.sstatic.net/aSFsc.png Here is ...

Load Bootstrap CSS file externally on a website dynamically

Although my knowledge of JavaScript is limited, I am the recipient of a small web application from a friend that is being utilized by multiple companies. As each company requires specific modifications in the appearance and CSS of certain webpages, it can ...

Having trouble retrieving accurate text information from a JavaScript link

I am encountering an issue with my code which consists of links with divs inside them. When I click on a link, it should display another div with data for "Case No" and "Type". However, the problem is that it only fetches the data from the first link click ...

What is the best way to implement a CSS transition in React when the state changes, the component remounts, or it re-rend

Imagine having a React functional component with some basic state: import React, { useState } from 'react' import { makeStyles } from "@material-ui/core" export default function Cart() { const [itemNumber, setItemNumber] = useState ...

Laravel Tutorial: Utilizing for and foreach Loops to Showcase Data in Blade Template

I am trying to use a for and foreach loop to display data based on a template table. However, I am running into an issue where the else conditions always display an index of their own. My expectation is as follows: https://i.stack.imgur.com/tqDSn.png Th ...

Having Issues with Cms Installation

I've been experimenting with a content management system that I plan to use for a project, but I encountered some errors. It seems like any "dynamic" elements are not displaying properly. Warning: mysqli::prepare() [mysqli.prepare]: (42S02/1146): Tab ...