What is the best way to position href text on the top of a rectangular div box?

Whenever I try to position the text above the rectangle, it disables the link. How can I resolve this issue? Additionally,

when attempting to change the color of the "San Diego" text, I'm unable to adjust its position. Just a heads up, I am new to HTML.

  #ViewOnMaps {
    background-color: #FF604C;
    height: 35px;
    width: 150px;
    position: absolute;
    top: 245px;
    left: 50px;
    opacity: .5;
  }
  #circular {
    width: 150px;
    height: 150px;
    border-radius: 150px;
    -webkit-border-radius: 150px;
    -moz-border-radius: 150px;
    background: url(http://media-cdn.tripadvisor.com/media/photo-s/02/5f/16/e4/la-jolla-cove.jpg) no-repeat;
    position: absolute;
    top: 15px;
    left: 45px;
  }
  span.SanDiego {
    position: absolute;
    top: 250px;
    left: 70px;
    width: 100%;
    font-size: 20px;
    color: #999;
  }
  span.ViewOnMaps {
    position: absolute;
    top: 235px;
    left: 78px;
  }
  #maps {
    background-color: white;
    height: 300px;
    width: 220px;
    border-style: solid;
    border-color: #B4B4B4
  }
  #menu {
    position: absolute;
    right: 52px;
    bottom: 638px;
  }
  body {
    background-color: #E8E8E8;
  }
  nav {
    background-color: white;
    height: 75px;
    width: 1140px;
    float: right;
    border-style: solid;
    border-color: #B4B4B4
  }
  nav ul {} nav ul li {
    list-style-type: none;
    width: 150px;
    float: left;
    text-align: center;
  }
  li a {
    text-decoration: none;
    color: #999;
    line-height: 50px;
    display: block;
  }
  li a:hover {
    text-decoration: underline;
    color: #FF604C;
  }
<nav>
  <ul id="menu">
    <li><a href="flatuigoal.html">Home</a>
    </li>
    <li><a href="gallery.html">Gallery</a>
    </li>
    <li><a href="#">Message</a>
    </li>
    <li><a href="#">Music</a>
    </li>
    <li><a href="#">Search</a>
    </li>
    <li><a href="#">Settings</a>
    </li>
    <li><a href="#">Location</a>
    </li>
  </ul>
</nav>
<div id="maps"></div>
<div id="circular"></div>
<span class="SanDiego">
    <a href="https://www.google.com/maps/place/San+Diego,+CA/@32.8245525,-117.0951632,10z/data=!3m1!4b1!4m2!3m1!1s0x80d9530fad921e4b:0xd3a21fdfd15df79">View on Maps</a>
  </span>
<div id="ViewOnMaps"></div>

Answer №1

Switch up your look with this

span.LosAngeles {
    position: relative;
    top: 150px;
    left: 50px;
    width: 90%;
    font-size: 18px;
    z-index:2;
}
.LosAngeles a {color:blue} /*--Customize the text color here--*/

See Demo

Answer №2

Your excessive use of positioning for elements is unnecessary. If you are utilizing absolute positioning, make sure to specify position:relative to the parent div in order to prevent it being relative to the body of the HTML instead.

I may not have fully grasped your question, but based on my understanding, I have attempted to provide a solution as best as I could. Here is the link to the solution: http://codepen.io/vikrantnegi007/pen/LVqvjN

Below is the HTML Code:

<div id="maps">
    <div id="circular">

    </div>
    <div class="SanDiego">
        <a href="https://www.google.com/maps/place/San+Diego,+CA/@32.8245525,-117.0951632,10z/data=!3m1!4b1!4m2!3m1!1s0x80d9530fad921e4b:0xd3a21fdfd15df79">View on Maps</a>
    </div>

</div>

    <nav>
  <ul id="menu">
    <li><a href="flatuigoal.html">Home</a>
    </li>
    <li><a href="gallery.html">Gallery</a>
    </li>
    <li><a href="#">Message</a>
    </li>
    <li><a href="#">Music</a>
    </li>
    <li><a href="#">Search</a>
    </li>
    <li><a href="#">Settings</a>
    </li>
    <li><a href="#">Location</a>
    </li>
  </ul>
</nav>

Here is the CSS Code:

  #circular {
    width: 150px;
    height: 150px;
    border-radius: 150px;
    -webkit-border-radius: 150px;
    -moz-border-radius: 150px;
    background: url(http://media-cdn.tripadvisor.com/media/photo-s/02/5f/16/e4/la-jolla-cove.jpg) no-repeat;
    position: absolute;
    top: 15px;
    left: 35px;
  }
  div.SanDiego {
    background-color: #ff604c;
    padding: 15px;
    opacity: 0.5;
    position: absolute;
    top: 220px;
    left: 35px;    
    font-size: 20px;
    color: #999;
  }

  #maps {
    background-color: white;
    height: 300px;
    width: 220px;
    border-style: solid;
    border-color: #B4B4B4;
    float: left;
    position: relative;
  }
  #menu {

    right: 52px;
    bottom: 638px;
  }
  body {
    background-color: #E8E8E8;
  }
  nav {
    background-color: white;
    height: 75px;
    width: 1140px;
    float: left;
    border-style: solid;
    border-color: #B4B4B4;
    margin-left: 30px;
  }
  nav ul {} nav ul li {
    list-style-type: none;
    width: 150px;
    float: left;
    text-align: center;
  }
  li a {
    text-decoration: none;
    color: #999;
    line-height: 50px;
    display: block;
  }
  li a:hover {
    text-decoration: underline;
    color: #FF604C;
  }

Let me know if there are any other adjustments you would like me to make.

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

Can you provide some examples of CSS code snippets?

Can someone share some CSS codes similar to :hover that can be used in the : part for different effects? I tried looking it up but couldn't find much, so any help would be greatly appreciated. ...

Create an animated underline for two CSS tabs

I'm interested in learning how to create a similar animation using JS, jQuery, or Vue Transitions with Bootstrap. I want to achieve the effect of moving the line under TAB1 to the right when TAB2 is clicked. Can anyone guide me on animating the div sm ...

Make sure to keep "display:inline-block" in place while using fadeTo()

As a design student, I am working on creating a family tree website where users can click on individual circles (ancestors) to view their lineage. Everything has been functioning smoothly so far, except for when attempting to display the lineage of specifi ...

Having an iframe at the bottom of the page is causing unnecessary white space below the

I currently have an iframe placed in the footer of my website. When I try to set the height of the iframe to match the height of the footer, it results in unwanted white space appearing below the iframe. The issue can be seen here: JSFiddle To fix this p ...

Utilize a unique font exclusively for Internet Explorer

I am encountering a significant issue trying to utilize custom fonts in Internet Explorer. Currently, I have implemented a specific font using @font-face and it works perfectly in modern browsers but fails to render properly in IE. The method I am curren ...

Enhancing OpenSeadragon images with custom overlays and managing error messages

Currently, I am experimenting with the Basic Single-Row Tile Source Collection example using the same configurations and tile sources outlined in the example. However, I am encountering difficulties in adding overlays to the first and second images as int ...

Calculate the sum of a column in a table that is dynamically populated

I'm using jQuery to load a table with data: function getSales(customerId, fromDate, toDate){ $.ajax({ type: 'POST', url: 'ajax/sale_pl.php', data:{customer_id:customerId, from_date:fromD ...

SweetAlert html is not recognizing ng-app, but it functions correctly within the html body

When inserting a bootstrap table inside a SweetAlert, I encountered an issue where using ng-app or ng-repeat to populate data inside the table's rows did not call ng-app. However, when populating the table outside of the SweetAlert in the body, ng-app ...

Additional white sheet included with TCPDF

I have been working with TCPDF to convert PHP-generated pages from MySQL queries. Each record is contained within a div and uses the style "page-break-after:always". However, I am encountering an issue where an extra blank page appears at the end of the PD ...

What is the best way to align the bottom of an anchor element with the bottom of an SVG element when positioning them together

I am working on a test website where I am trying to create an interesting visual layout. My goal is to place an SVG image in the background, with an anchor element and other elements laid out above it. The challenge I am facing is aligning the bottom of th ...

Can a CSS3 filter be utilized to transform gradient colors into solid colors?

I have an interesting scenario where I am using a -webkit-mask with a radial-gradient to create small dots on a background image. These dots are transparent, allowing the background image to show through. However, each dot has a gradient color within it. ...

What are the steps to modify data within the root component?

I am currently working on a Vue project with vue-cli and routes. In my App.vue file, the template structure is as follows: <template> <div id="app"> {{Main}} <router-view></router-view> </div> </template&g ...

Is there a way to ensure that GIFs in jQuery Mobile always start from the beginning?

My cross-platform mobile app built with jQuery Mobile is a small quiz application. After each correct or wrong answer, I display a 3-second GIF. Currently, I have set up the code to show the GIF for 3 seconds before moving on to the next page: else if ($. ...

Is it possible to nest a <dl> list within a <li> item?

Would it be considered semantically accurate to include a dl (along with some dt / dd elements) inside a li tag? While it's common to add block or inline elements within an li element, the feasibility of including dl, dt, and dd elements is uncertain ...

Issue with IE11: Flexbox with absolute positioning not sizing correctly, fills entire width instead of individual content

Here's a simple case to reproduce the issue: <div style="display: inline-block; position: relative; border: 1px solid black;"> short <div style="display: flex; position: absolute; border: 1px solid black; top: 100%; lef ...

Incorporating Bootstrap Content: A Guide to Including a PHP File within Another PHP File

I am encountering an issue when trying to import a PHP file containing my navigation bar into another PHP file. Here's the code for the navigation file: <?php echo " <html> <head> <nav class = "navbar navbar-default navbar-fixed-top ...

Seeking the "onChange" functionality while implementing the "addEventListener" method

I've been busy with a React project lately. Instead of adding 'onChange' to each button within the html object like this: <input type='text' onChange={myFunction} /> I'd prefer to include it in the JS code like so: doc ...

Issues with rendering HTML5 drag and drop styles are not visible on a Windows Server 2003 platform

I am currently developing a file upload tool utilizing Valum's Ajax-Uploader as the foundation. The concept is reminiscent of how attaching files works in Gmail. Users should be able to simply drag and drop a file from their desktop into the browser w ...

What is the best way to capture user input using an onClick event in JavaScript and then display it on the screen?

I'm in the process of upgrading a table, and while most of it is working fine, there is one function that's giving me trouble. I want this function to return an input with an inline onClick event. The actual return value is displaying correctly, ...

Display HTML instead of text in print mode

Hello, I need help with printing HTML code, specifically an iframe. When I try to add my HTML iframe code, it only prints as plain text. I want to be able to see the actual iframe with its content displayed. Thank you. <script> const messages = [&apo ...