Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help with creating a link that does not replace the css style

Featured Replies

Please help, im trying to add a link into html that wont overwrite my css...

 

I have this in the html

 

<div id="banner">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Css Letterpress and Drop Shadow</title>

<link href="custom.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="letterpress">

<h1>text here</h1>

</div>

</body>

</html>

</div>

 

I then have all the css style for letterpress in custom css, this all works fine until I add <a href="{{store url="home"}}"> within the banner div, then it changes the text style to grey, because I have "a" as another text style earlier in the css.

 

I cant work out how to create a link without using "a" in the <a href

 

I would like to have it so that the whole banner is a link to "home" but when i do this, the "a" messes up the text style...

 

any help would be great, Thanks!

Hi

 

if you mean you are try doing something like this

 

<div id="letterpress">

<h1>text here</h1>

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

</div>

 

why not set the css to it like

 

#letterpress a{

color:pink

}

 

of course you could do something similar on the actual <a> tag that is messing it up further up the page just be a little more specific when you set the css rules

 

Cheers

 

Ysuran

Only guessing, but you can use an inline style or a class.

 

Inline:

<a style="color: red;">Link Here</a>

 

Class:

.bannerlink {color: red; }

<a class="bannerlink">Link Here</a>

 

Otherwise I am not sure what you are reffering to I am afraid.

  • Author

Hi,

 

Thanks, very helpful comments.

 

I have managed to get exactly what I want by adding a more specific css to the link inside the letterpress div:

 

#letterpress a{

color:pink

}

 

Thanks for that Ysuran.

 

This works perfect in Safari, the whole banner and the text within the letterpress div inside the banner image is the link. However in Firefox it is just the text that is the link, and the banner image is not a link!! strange, but the styling is the same in both, so that is perfectly good enough.

 

Next time I think I will set it up properly from the start with inline styling.

 

Cheers,

Hecsmac

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.