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.

Styling within a <head> tag

Featured Replies

Hi all, I was wondering how I would go about styling text that is contained within a <script> tag inside the <head> tag (if you know what I mean)

 

I'm trying to add Google Maps API V3 to a site, but am testing it in a plain HTML file first. I have it styled pretty much the way I need it, but the styling I have is:

 

html { height: 100% }
body { height: 100%; margin: 0; padding: 0; font-family: Arial, sans-serif; font-size: 14px; }
#map_canvas { height: 100% }
h1 { font-size: 18px; margin: 0 0 5px 0; padding: 0; }
img { float: right; }

 

which is all in the HTML file. This is what I am trying to style when I add this coding to my site:

 

var infowindow = new google.maps.InfoWindow({
content: '<h1>Kilians Lodge</h1><img src="image.jpg"> Main St,<br /> Mullagh,<br /> Co. Cavan, <br />046 924 2201 <br /><a href="http://www.kilianslodge.com">www.kilianslodge.com</a>',
map: map
});

 

So I can't throw the current CSS into the site or it will change the body of the site.

Any advice on this, thanks.

Al.

Have you tried adding class or id attributes to the html within the script? That way, you can style the tags by using class or id selectors in your css?

 

It's currently 7am and I haven't slept yet, so sorry if I'm missing something.

Edited by Pete Prosper

Just wrap that HTML bit in a div tag, give the div a class, and apply styles to it's children.

 

.class h1, .class p etc.

  • Author

Great thanks guys, I just wasn't too sure about how to figure that one out, but now that you say it it seems very simple and I should have known.

 

Thanks :)

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.