• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Code tags on website

 
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am wanting to style a code tag on my website that works much like most do on forums like this one. Right now I have the yellow background and different font working fine on single line code, but once I try multi-line code I run into problems. For a two line code it shows two yellow boxes that overlap each other. I essentially have to put new lines between them until they line up. There has to be an easier way.

This is what I have on for my code tag in my style.css



You can see a post I have with code tags here

http://randomlyjames.com/2012/06/oracle-10g-new-purge-feature/

I do not have any multi-line examples since they do not look right.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The <code> tag is an inline element, not a block element. Why aren't you using <pre>?
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The <code> tag is an inline element, not a block element. Why aren't you using <pre>?



pre as it sits does not put the text inside a box like I want. Should I just change by style.css so it says pre instead of code?
 
Bear Bibeault
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Give it a try and see if it results in the appearance that you want.
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Give it a try and see if it results in the appearance that you want.



I have this in my style.css



Which works as a multi-line code box, but now anything I type after the 'end PRE' ends up beside the 'code box' and not below it. UGH!

 
Legend has it that if you rub the right tiny ad, a genie comes out.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic